简体   繁体   English

VSCode是否支持变量和函数语法突出显示?

[英]Does VSCode support variable and function syntax highlighting?

The only kind of highlighting I'm seeing in VSCode (using C#) is a highlighting of reserved keywords. 我在VSCode中看到的唯一一种突出显示(使用C#)是突出显示保留关键字。 Other code editors I use (Xcode, MonoDevelop) all highlight local variables/functions and member variables/functions as well. 我使用的其他代码编辑器(Xcode,MonoDevelop)都突出显示了局部变量/函数以及成员变量/函数。 Can't find the option in VSCode to do this. 在VSCode中找不到执行此操作的选项。 Am I missing something somewhere? 我在某处缺少什么吗?

There is currently no context aware highlighting available in Visual Studio Code. 当前在Visual Studio Code中没有上下文感知突出显示。 The highlighter is based on regular expressions. 荧光笔基于正则表达式。 In order to highlight references to local variables or type names differently the highlighter would need to access a symbol table. 为了突出显示对局部变量或类型名称的引用,突出显示器将需要访问符号表。 I hope this will come in future versions. 我希望这会在将来的版本中出现。

Just a note, VSCode utilises the OmniSharp project for C# intellisense. 仅需注意,VSCode将OmniSharp项目用于C#智能感知。 If it does not have proper syntax highlighting at this time, I am sure it will happen in the future. 如果此时没有突出显示正确的语法,我相信将来会发生。

I say this as the omnisharp-roslyn server already provides an API end point for Semantic Highlighting. 我说这是因为omnisharp-roslyn服务器已经提供了语义突出显示的API端点 And omnisharp-roslyn powers VS Code (and many other editors!). omn​​isharp-roslyn为VS Code(以及其他许多编辑器)提供了强大的功能。

If you're impatient and want to have that feature now, have a look at the omnisharp-atom project. 如果您不耐烦并且想立即使用该功能,请查看omn​​isharp-atom项目。 We have an implementation for proper semantic syntax highlighting utilising the same omnisharp-roslyn server bits as VS Code. 我们使用与VS Code相同的omnisharp-roslyn服务器位来实现适当的语义语法突出显示的实现。

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

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