Showing posts with label ace-editor. Show all posts
Showing posts with label ace-editor. Show all posts

Friday, July 27, 2018

Ace editor coloring words

Leave a Comment

I'm trying to colorize some specific words in the Ace editor (for example I want the word 'Hello' to be colored in red). I tried working with their 'highlight rules' (https://ace.c9.io/#nav=higlighter) but it doesn't seem to work.

I'm working with react and javascript by the way.

Can anyone suggest a solution or example?

1 Answers

Answers 1

Ace doesn't provide this feature by default, but you can using 'custom highlight rules' in ace editor.

I know that they have released this feature for customizing various new languages.

Ref:

https://cloud9-sdk.readme.io/docs/highlighting-rules

Related Stack Answer:

Want to highlight/change color of certain words in Ace Editor?

Read More

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.

Read More