diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-09-19 21:21:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-09-19 21:21:59 +0800 |
commit | 2247737e799f23e54317aead2d75fe190acc5895 (patch) | |
tree | eef241f873e2df4a7260ecf0a5a50fbc1a1eccad | |
parent | 1f93575f7fc938cd675214ebd04bbe4210f6f8ac (diff) | |
download | lua-language-server-2247737e799f23e54317aead2d75fe190acc5895.zip |
resolve #1458
mark global variables to `variable.global`
-rw-r--r-- | .vscode/settings.json | 9 | ||||
-rw-r--r-- | changelog.md | 11 | ||||
-rw-r--r-- | script/core/semantic-tokens.lua | 2 | ||||
-rw-r--r-- | script/proto/define.lua | 1 |
4 files changed, 20 insertions, 3 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index e7be186e..0949f10d 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 bff1c503..ea380303 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 5833807b..bc9bf8af 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 75843455..1bc1000d 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 = { |