Saturday, April 30, 2016

How to force soft wrap from ACE editor mode?

Leave a Comment

I'm writing a custom mode for the ACE editor to support my toy template language.

In the language there is a construct to embed a newline:

foo{\n}bar 

It will be rendered with a newline, as follows:

foo bar 

I would like to imitate this in the editor and force a soft wrap after {\n}:

1 | foo{\n}   | bar 

Is there a way to do this in my mode?

1 Answers

Answers 1

Without code, it's a bit hard to reproduce, but according to the class diagram, you need to interact with the VirtualRenderer to alter how things are displayed.

It takes a theme to style the code. (you can select these in the editor at the Theme-menu). Themes are css (+js) files, which opens the possibility of using this trick to insert a newline after your {\n} element class.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment