Skip to content

Commit

Permalink
resolve #1458
Browse files Browse the repository at this point in the history
mark global variables to `variable.global`
  • Loading branch information
sumneko committed Sep 19, 2022
1 parent 1f93575 commit 2247737
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@
"--dbgport=11413",
"--loglevel=trace",
//"--lazy",
]
],
"editor.semanticTokenColorCustomizations": {
"rules": {
"variable.global": {
"foreground": "#ffcc00",
}
}
}
}
11 changes: 10 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion script/core/semantic-tokens.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions script/proto/define.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ m.TokenModifiers = {
["modification"] = 1 << 7,
["documentation"] = 1 << 8,
["defaultLibrary"] = 1 << 9,
["global"] = 1 << 10,
}

m.TokenTypes = {
Expand Down

0 comments on commit 2247737

Please sign in to comment.