【问题标题】:Custom color highlighting for Pylance in VS Code: defined variables in white, undefined variables in redVS Code 中 Pylance 的自定义颜色突出显示:已定义变量为白色,未定义变量为红色
【发布时间】:2022-11-01 13:30:56
【问题描述】:
标签:
python
visual-studio-code
pylance
【解决方案1】:
以下配置可能对您有用
// settings.json file
{
"editor.tokenColorCustomizations":{
// I guess you are using the dark+ theme,
// because I use the dark theme and enable semantic highlighting
// with both defined and undefined variables in white color.
"[Default Dark+]": {
"textMateRules": [
{
"scope": "meta.function-call.arguments.python",
"settings": {
"foreground": "#FF0000"
}
},
{
"scope": "variable.other.readwrite",
"settings": {
"foreground": "#ffffff"
}
},
{
"scope": "punctuation.separator.arguments.python",
"settings": {
"foreground": "#D4D4D4"
}
}
]
}
},
"editor.semanticHighlighting.enabled": true,
"workbench.colorTheme": "Default Dark+",
}
在我的电脑上看起来像这样
请注意,上述配置可能会导致其他意外更改。因为更改颜色的范围也可能在其他一些地方起作用。