diff options
-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, +} +```]] +} |