diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-24 21:20:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-24 21:20:48 +0800 |
commit | 35ecea910789fbd470d0c6d68b75409ac3c3e21e (patch) | |
tree | 391057909f25ff2948de11877aa3c6de2de2f6be | |
parent | f1701259a6c5ccf65d98020938737625277fa215 (diff) | |
download | lua-language-server-35ecea910789fbd470d0c6d68b75409ac3c3e21e.zip |
fix #817
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/searcher.lua | 7 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 23 |
3 files changed, 31 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index ff96a673..22bdec17 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # changelog ## 2.4.11 +* `FIX` [#817](https://github.com/sumneko/lua-language-server/issues/817) * `FIX` [#818](https://github.com/sumneko/lua-language-server/issues/818) * `FIX` [#820](https://github.com/sumneko/lua-language-server/issues/820) diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 6d1a03b6..e5de6395 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -786,6 +786,13 @@ function m.searchRefsByID(status, suri, expect, mode) end elseif mode == 'field' or mode == 'allfield' then + for _, guri in ceach('def:' .. id) do + if uri == guri then + goto CONTINUE + end + searchID(guri, id, field, uri) + ::CONTINUE:: + end for _, guri in ceach('field:' .. id) do if uri == guri then goto CONTINUE diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 35528446..dcd971de 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1051,3 +1051,26 @@ end local x: any ```]] } + +TEST { + { + path = 'a.lua', + content = [[ +---@class A +---@field x number +G = {} +]], + }, + { + path = 'b.lua', + content = [[ +<?G?> +]], + }, + hover = [[ +```lua +global G: A { + x: number, +} +```]] +} |