[英]Colorize using tokenizer on Monaco editor
I am trying to add different foreground colors using regular expressions for a method, property, and variable reference on Monaco editor using tokenizer.我正在尝试使用正则表达式添加不同的前景 colors 用于使用标记器的摩纳哥编辑器上的方法、属性和变量引用。
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.
在第二个示例中,它被引用为 object 的方法,第三个示例是 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**.即使方法、属性和变量名称相同,我也想使用 Monaco 编辑器**上的标记器将不同的前景 colors 着色为“名称”。
Your suggestion would be greatly appreciated.您的建议将不胜感激。
Thanks in advance.提前致谢。
What you are after is called "semantic highlighting" (in opposition to syntax highlighting) and the monaco-editor component alone cannot do that.您所追求的被称为“语义突出显示”(与语法突出显示相反),仅 monaco-editor 组件无法做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.