在使用 Monokai 颜色主题运行 Sublime Text 3 和 VS Code(或 Atom)时,Sublime Text 语法突出显示使用蓝色进行函数调用,如下例所示
但是,当我使用 monokai 主题在 VS Code 中打开相同的代码时,函数不会绘制为蓝色
我真的很想改变这一点,突出显示函数调用后代码看起来好多了。但是,我浏览了网络,找不到如何改变这种行为。有人对此有什么建议吗?
谢谢!
最佳答案
请参阅下面的更新!
看来我找到了一个临时解决方案。转到此文件夹(如果您使用的是 Mac)/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/theme-monokai/themes 并将此代码放入 monokai-color-theme 中.json 文件:
{
"name": "Function call",
"scope": "meta.function-call.generic",
"settings": {
"foreground": "#66d9efff"
}
},
这是一个示例: screenshot
但请记住,主题更新后,此更改可能会消失!
更新: 在突出显示方面遇到了更多麻烦后,我决定将带有主题的文件上传到 GitHub 并保持更新。因此,如果您不想深入研究代码,只需查看我的存储库:https://github.com/spyker77/monokai-theme-extended
更新(2021 年 4 月)
事实证明,之前的解决方案是不可持续的。因此目前更好的可能是:
- 在 Visual Studio Code 中,转到“代码”=>“首选项”=>“颜色主题”并选择 Monokai;
- 打开
settings.json
文件 ( how-to ); - 那里可能已经有一堆设置,所以您需要做的就是在末尾和右大括号之前添加以下自定义(不要忘记在您继续的最后一个设置之后添加尾随逗号) :
"editor.tokenColorCustomizations": {
"[Monokai]": {
"textMateRules": [
{
"name": "Decorator definition decorator",
"scope": "punctuation.definition.decorator.python",
"settings": {
"foreground": "#F92672"
}
},
{
"name": "Meta function-call",
"scope": "meta.function-call.generic.python",
"settings": {
"foreground": "#66D9EF"
}
},
{
"name": "Storage type function async",
"scope": "storage.type.function.async.python",
"settings": {
"foreground": "#F92672",
}
},
{
"name": "Punctuation separator period",
"scope": "punctuation.separator.period.python",
"settings": {
"foreground": "#F8F8F2",
}
},
{
"name": "Entity name function decorator",
"scope": "entity.name.function.decorator.python",
"settings": {
"foreground": "#66D9EF",
}
},
{
"name": "Entity name type class",
"scope": "entity.name.type.class.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "Entity other inherited-class",
"scope": "entity.other.inherited-class.python",
"settings": {
"fontStyle": "italic"
}
},
{
"name": "Support type python",
"scope": "support.type.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "String quoted docstring multi python",
"scope": "string.quoted.docstring.multi.python",
"settings": {
"foreground": "#88846F",
}
}
]
}
}
关于sublimetext3 - 在 VS Code/Atom 和 Sublime 中使用 monokai 进行函数高亮显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43312159/