diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/core/semantic-tokens.lua | 20 |
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 |