summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-06-14 15:02:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-06-14 15:02:49 +0800
commitd9f97b8e0b3938802d16a14f917a04cb43ebc648 (patch)
tree966d069d454cf70b51c01e6e45aec6451035dad3
parent4259e92b65dc5091147eea593b831cf6e41ee208 (diff)
downloadlua-language-server-d9f97b8e0b3938802d16a14f917a04cb43ebc648.zip
fix #2129
-rw-r--r--changelog.md2
-rw-r--r--script/core/semantic-tokens.lua20
2 files changed, 16 insertions, 6 deletions
diff --git a/changelog.md b/changelog.md
index 5fede5aa..f9af33f7 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,6 +7,7 @@
* `FIX` [#2083]
* `FIX` [#2088]
* `FIX` [#2110]
+* `FIX` [#2129]
[#2038]: https://github.com/LuaLS/lua-language-server/issues/2038
[#2042]: https://github.com/LuaLS/lua-language-server/issues/2042
@@ -14,6 +15,7 @@
[#2083]: https://github.com/LuaLS/lua-language-server/issues/2083
[#2088]: https://github.com/LuaLS/lua-language-server/issues/2088
[#2110]: https://github.com/LuaLS/lua-language-server/issues/2110
+[#2129]: https://github.com/LuaLS/lua-language-server/issues/2129
## 3.6.21
`2023-5-24`
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 4d191b69..cd19e2ee 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -138,12 +138,20 @@ local Care = util.switch()
local uri = guide.getUri(loc)
-- 1. 值为函数的局部变量 | Local variable whose value is a function
if vm.getInfer(source):hasFunction(uri) then
- results[#results+1] = {
- start = source.start,
- finish = source.finish,
- type = define.TokenTypes['function'],
- modifieres = define.TokenModifiers.declaration,
- }
+ if source.type == 'local' then
+ results[#results+1] = {
+ start = source.start,
+ finish = source.finish,
+ type = define.TokenTypes['function'],
+ modifieres = define.TokenModifiers.declaration,
+ }
+ else
+ results[#results+1] = {
+ start = source.start,
+ finish = source.finish,
+ type = define.TokenTypes['function'],
+ }
+ end
return
end
-- 3. 特殊变量 | Special variableif source[1] == '_ENV' then