diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-04-26 10:41:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-04-26 10:41:03 +0800 |
commit | 881e16b99cc1dd35d0e50af4b14d43635d0a474d (patch) | |
tree | e830877b3c2420dd04ff8874319671747245e87f | |
parent | 02d43a59203e1d04aaaae3eacdaae5110da6b06d (diff) | |
download | lua-language-server-881e16b99cc1dd35d0e50af4b14d43635d0a474d.zip |
don't merge comments from `setlocal`
fix #2077
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/core/hover/init.lua | 3 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 19 |
3 files changed, 23 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index c17cdff0..8676660d 100644 --- a/changelog.md +++ b/changelog.md @@ -4,10 +4,12 @@ * `FIX` commandline parameter `checklevel` may not work * `FIX` [#2036] * `FIX` [#2037] +* `FIX` [#2077] * `FIX` [#2081] [#2036]: https://github.com/LuaLS/lua-language-server/issues/2036 [#2037]: https://github.com/LuaLS/lua-language-server/issues/2037 +[#2077]: https://github.com/LuaLS/lua-language-server/issues/2077 [#2081]: https://github.com/LuaLS/lua-language-server/issues/2081 ## 3.6.18 diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua index fb5f7cd5..ed596b3d 100644 --- a/script/core/hover/init.lua +++ b/script/core/hover/init.lua @@ -86,7 +86,8 @@ local function getHover(source) else addHover(source, true, oop) for _, def in ipairs(vm.getDefs(source)) do - if def.type == 'global' then + if def.type == 'global' + or def.type == 'setlocal' then goto CONTINUE end if guide.isOOP(def) then diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 7763d643..d013af98 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1776,3 +1776,22 @@ function foo(bar: any, baz: any) @*param* `baz` — "dolor sit" this is ignored]] } + +TEST { {path = 'a.lua', content = [[ +--comment1 +local x + +--comment2 +x = 1 + +print(<?x?>) +]]}, +hover = [[ +```lua +local x: integer = 1 +``` + +--- + +comment1]] +} |