Rust mut变量方法添加下划线
描述:就是标题所说的
这是eva主题下的mut变量及方法
这是默认白主题下的mut变量及方法
不清楚这个标注是ra插件的效果还是主题标注的效果(
https://github.com/JunkuiZhang/LightGreen/blob/master/themes/slr-color-theme.json 或许可以参考这个
我电脑上默认主题下,mut变量也没有下划线,而且scope值和非mut变量一样的(shift+ctrl+P,搜索scopes,回车)
您截图下您电脑上这二种变量的scope值呢?
我指的是VSCode新增的现代浅色,不是默认浅色,说错了(
另外这是两种scope
mut
非mut
我开启了semanticHighlighting,但我电脑上的Rust文件还是没有semantic scope标注...
您在VSCode的Settings.json文件里加入下面设置试试
"editor.semanticHighlighting.enabled": true,
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"semanticTokenColors": {
"*.mutable": {
"underline": true,
},
},
}
},
看了一下,这个是使用rust-analyzer插件的情况下才会出现的mutable标注,或许是这个导致的?
我安装了那个插件
怪了,我用eva主题的话看scope也没有mutable相关的信息
Eva Theme是默认不开启semanticHighLighting的,要在Eva Theme下看semantic scope标注,在设置里加上
"editor.semanticHighlighting.enabled": true,
打开之后确实在scope有一些变化
加上这个设置,有下划线吗?
"editor.semanticHighlighting.enabled": true,
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"semanticTokenColors": {
"*.mutable": {
"underline": true,
},
},
}
},
颜色变了,但还是没有下划线
可能没有semanticHighlighting的话无法给mut变量设置下划线吧
Eva Theme没开启semanticHighLighting的详细原因在issue54
试了一下,想要给 mut 变量添加下划线,Settings.json 里好像要这么写:
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"*.mutable": {
"underline": true,
},
}
},
这样好像也不需要额外设置editor.semanticHighlighting.enabled了