[英]How can I make user-defined highlight for C# in VS Code
Recently I installed VS Code and C# plugin for it.最近我为它安装了 VS Code 和 C# 插件。 I must say that I really like the editor.我必须说我真的很喜欢这个编辑器。 It is very lightweight and highly customizable.它非常轻巧且高度可定制。 However I haven't found how can I redefine several colorization options such as highlighting classes inside field definitions or local variables?但是我还没有找到如何重新定义几个着色选项,例如突出显示字段定义或局部变量中的类?
I already use standard C# colorizer.我已经在使用标准的 C# 着色器。 I just want to customize the color of some lexemes, not everything.我只是想自定义一些词素的颜色,而不是一切。
Checkout the docs here:在此处查看文档:
https://code.visualstudio.com/Docs/customization/colorizer https://code.visualstudio.com/Docs/customization/colorizer
You basically either get one from the marketplace or generate a basic editable file with yeoman.您基本上要么从市场上获得一个,要么使用 yeoman 生成一个基本的可编辑文件。
You can also add themes even from color sublime as described here:您甚至可以从 color sublime 中添加主题,如下所述:
https://code.visualstudio.com/docs/customization/themes https://code.visualstudio.com/docs/customization/themes
Install theme from extensions from which you wish to start.从您希望开始的扩展安装主题。
Then find where the theme got installed.然后找到安装主题的位置。 On Windows it would be %USERPROFILE%\\.vscode\\extensions
, see details inInstalling extensions .在 Windows 上,它将是%USERPROFILE%\\.vscode\\extensions
,请参阅安装扩展中的详细信息。
There you'll find folder with theme, inside is themes
folder and <something>.tmTheme
file which is actually xml file.在那里你会找到带有主题的文件夹,里面是themes
文件夹和<something>.tmTheme
文件,它实际上是 xml 文件。 Open it inside VSCode and start editing :)在 VSCode 中打开它并开始编辑 :)
You'll find items and colors, syntax is described elsewhere, but common sense will help you.你会找到项目和颜色,语法在别处描述,但常识会帮助你。
To test change, open desired .cs file in same editor.要测试更改,请在同一编辑器中打开所需的 .cs 文件。 Changes are applied after restart, so it's also good to make key shortcut to restart the editor:重新启动后会应用更改,因此也可以使用快捷键来重新启动编辑器:
keybindings.json键绑定.json
...
{
"key": "ctrl+shift+alt+r",
"command": "workbench.action.reloadWindow"
}
...
Then try color, restart, see result, continue...然后尝试颜色,重新启动,查看结果,继续...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.