diff --git a/.vscode/settings.json b/.vscode/settings.json index e7be186ef..0949f10da 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,12 @@ "--dbgport=11413", "--loglevel=trace", //"--lazy", - ] + ], + "editor.semanticTokenColorCustomizations": { + "rules": { + "variable.global": { + "foreground": "#ffcc00", + } + } + } } diff --git a/changelog.md b/changelog.md index bff1c5039..ea3803034 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,16 @@ # changelog ## 3.6.0 -* `CHG` detect multi libraries [#1558](https://github.com/sumneko/lua-language-server/issues/1558) +* `CHG` [#1558](https://github.com/sumneko/lua-language-server/issues/1558) detect multi libraries +* `CHG` [#1558](https://github.com/sumneko/lua-language-server/issues/1558) `semantic-tokens`: global variable is setted to `variable.global` + ```jsonc + // color global variables to red + "editor.semanticTokenColorCustomizations": { + "rules": { + "variable.global": "#ff0000" + } + } + ``` ## 3.5.6 `2022-9-16` diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 5833807bf..bc9bf8afd 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -35,7 +35,7 @@ local Care = util.switch() local isFunc = vm.getInfer(source):hasFunction(guide.getUri(source)) local type = isFunc and define.TokenTypes['function'] or define.TokenTypes.variable - local modifier = isLib and define.TokenModifiers.defaultLibrary or define.TokenModifiers.static + local modifier = isLib and define.TokenModifiers.defaultLibrary or define.TokenModifiers.global results[#results+1] = { start = source.start, diff --git a/script/proto/define.lua b/script/proto/define.lua index 75843455b..1bc1000d3 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -136,6 +136,7 @@ m.TokenModifiers = { ["modification"] = 1 << 7, ["documentation"] = 1 << 8, ["defaultLibrary"] = 1 << 9, + ["global"] = 1 << 10, } m.TokenTypes = {