简体   繁体   English

VSCode中的动态语法突出显示

[英]Dynamic Syntax Highlighting in VSCode

I'm writing an extension for Visual Studio Code which features syntax highlighting for a scripting language. 我正在为Visual Studio Code编写扩展,该扩展具有针对脚本语言的语法突出显示功能。 I was able to color many important elements via a TextMate grammar file. 我可以通过TextMate语法文件为许多重要元素着色。 There are many lines where I would not know if a captured string refers to a user defined class (for a static call, for instance), or an instance of a class/variable until I perform analysis in code. 在很多行中,直到我执行代码分析之前,我都不知道捕获的字符串是指向用户定义的类(例如,用于静态调用)还是类/变量的实例。

Is there a way I can dynamically highlight syntax via code in Visual Studio Code or any alternatives for achieving this? 有没有一种方法可以通过Visual Studio Code中的代码或其他替代方法来动态突出显示语法?

What you are asking for is semantic coloring. 您要的是语义着色。 It is not supported as of VS Code 1.35. 从VS Code 1.35开始不支持此功能。 You could try to emulate it using decorators , but the decorators can easily get out of sync with the rest of the highlighting during editing 您可以尝试使用装饰器模拟它,但是装饰器在编辑过程中很容易与其余突出显示不同步

This VS Code issue tracks adding semantic coloring to VS Code. 此VS Code问题跟踪了向VS Code添加语义着色的过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM