如何查看作用域:
1.按快捷键F1或者组合键ctrl+shift+p打开命令输入框,输入关键字“scopes”,找到并选择“开发人员:检查编辑器标记和作用域”选项;
2.点击代码中想要改变颜色的代码段,即可显示关于该代码段的说明和作用域,然后将其复制并粘贴到setting.json文件里的scope字段下,即可。
*可以看到一个代码段的作用域可能有多个,它们分别代表着不同的作用范围(作用范围由小到大自上而下排列,也就是说,最上面的一条代表着范围最小最精确的作用域)
*参考链接:
https://www.cnblogs.com/maojs/p/13901828.html
https://geek-docs.com/vscode/vscode-tutorials/vscode-modify-editor-color-matching.html
最后附上我目前在用的,还在动态调整中,仅供参考
{
"workbench.iconTheme": "vscode-icons",
"files.associations": {
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
"emmet.includeLanguages": {
"wxml": "html"
},
"editor.autoClosingBrackets": "always",
"editor.autoClosingQuotes": "always",
"files.autoSave": "onFocusChange",
"editor.minimap.enabled": false, //关闭右侧快速预览窗
"breadcrumbs.enabled": true,
//允许编辑区滚动鼠标缩放
"editor.mouseWheelZoom": true,
"update.enableWindowsBackgroundUpdates":true,
"git.ignoreMissingGitWarning": true,
//"editor.fontFamily": "'Fira Code',Menlo, Monaco, 'Courier New', monospace", // 设置字体显示
"editor.fontLigatures": false,//控制是否启用字体连字,true启用,false不启用
//"editor.fontFamily": "'Fira Code', Consolas, mononoki,'Courier New', monospace",
"editor.fontFamily": "Fira Code",
//"editor.fontFamily": "Consolas",
//"editor.fontFamily": "Monaco",
//"editor.fontFamily": "Inconsolata",
//"editor.fontFamily": "source code pro",
//终端不支持Fira code
"terminal.integrated.fontFamily": "monospace",
//终端广播闪烁
"terminal.integrated.cursorBlinking": true,
//按alt滚动速度加倍
"terminal.integrated.fastScrollSensitivity": 5,
//类型linux环境 选中即复制
"terminal.integrated.copyOnSelection": true,
"terminal.integrated.fontSize": 16,
"terminal.integrated.fontWeightBold": "bold",
//"editor.fontLigatures": true,
"editor.renderLineHighlight": "none",
"editor.lineHeight": 24,
"editor.roundedSelection": false,
"editor.fontSize": 18,
"editor.lineNumbers":"on" ,
"editor.tokenColorCustomizations": {
"comments": "#5cb380", // 注释
"keywords": "#ecbb1a", // 关键字
"variables": "#00f7ff", // 变量名
"strings": "#ebb756bd", // 字符串
"functions": "#ff0000", // 函数名
"types": "#f80ae4", //类型名 变量类型
"numbers": "#d7ee55d5" ,// 数字
//"storage": "#FF0000",
"textMateRules": [
// //函数
// {
// "scope": "meta.function-call.generic.python",
// "settings": {
// "foreground": "#0f7fd2"//#578dac, ##0f7fd2, #78a7cc,#84b6dd
// }
// },
// //函数内固定参数名
// {
// "scope": "variable.parameter.function-call.python",
// "settings": {
// "foreground": "#6b689efb"//#859900,79831f
// }
// },
// //三引号注释
// {
// "scope": "string.quoted.docstring.multi.python",
// "settings": {
// "foreground": "#10d4b0"//#709baa,
// }
// },
// // //类名&方法名
// // {
// // "scope": "storage.type",
// // "settings": {
// // "foreground": "#a8b1a6"
// // }
// // },
//局部变量
{
"name": "keyword",
"scope": "variable.other.local.c",
"settings": {
"foreground": "#548eda"//#29cf3d, #049415, #14b414
}
},
//关键字
{
"name": "keyword",
"scope": "keyword.control.flow.python",
"settings": {
"foreground": "#7f63c2"//#29cf3d, #049415, #14b414
}
},
// //类型名称
// {
// "name": "types",
// // "scope": ["comment", "comment",],
// "scope": "support.type.python",
// "settings": {
// "foreground": "#eea0cd"//#eea0cd
// }
// },
]
},
"workbench.colorCustomizations": {
"editor.selectionHighlightBackground": "#be4bb5",//选中代码高亮
"[Monokai]":{
"editor.foreground": "#3f1a1a",
"editor.selectionHighlightBorder": "#e7d917fa",
"editor.selectionHighlightBackground": "#e0dd14",
"editorIndentGuide.activeBackground":"#81868d",
"editorBracketMatch.background": "#ca9fdb5e",
"editorBracketMatch.border": "#ff0000",
"tab.activeBackground": "#ad9cd4b2",
"textLink.foreground": "#d6561ac4",
"descriptionForeground": "#ff0000",
"selection.background": "#b98cd693",
"textBlockQuote.background":"#b89a9a",
"textSeparator.foreground": "#86c2df"
},
},
// "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"files.autoGuessEncoding": true,
"launch": {
"configurations": [
]
}
}