Colorize using tokenizer on Monaco editor

473 Views Asked by At

I am trying to add different foreground colors using regular expressions for a method, property, and variable reference on Monaco editor using tokenizer.

Example:

Name="Hello"

var.Name()

var.Name

In these examples, Has anyone found a way to colorize "Name" differently based on how it is being used? In the first example, it is referenced as a variable. In the second example, it is referenced as a method of an object, and the third example is a property of an object.

Even though method, property, and variable are the same name, I want to colorize different foreground colors to "Name" using tokenizer on Monaco editor**.

Your suggestion would be greatly appreciated.
Thanks in advance.

1

There are 1 best solutions below

0
Mike Lischke On

What you are after is called "semantic highlighting" (in opposition to syntax highlighting) and the monaco-editor component alone cannot do that.