summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/core/hover/description.lua3
-rw-r--r--test/crossfile/hover.lua32
3 files changed, 38 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index d82b97b9..6ccdb225 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 1.20.1
+* `FIX` [#468](https://github.com/sumneko/lua-language-server/issues/468)
+
## 1.20.0
`2021-3-27`
* `CHG` telemetry: change to opt-in, see [#462](https://github.com/sumneko/lua-language-server/issues/462) and [Privacy-Policy](https://github.com/sumneko/lua-language-server/wiki/Privacy-Policy)
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index d081aa7f..3766d2f4 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -358,6 +358,9 @@ return function (source)
if source.type == 'string' then
return asString(source)
end
+ if source.type == 'field' then
+ source = source.parent
+ end
return tryDocOverloadToComment(source)
or tryDocFieldUpComment(source)
or tyrDocParamComment(source)
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index b72a6391..d0080ed9 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -684,3 +684,35 @@ hover = {
name = 'x',
description = 'BBB'
}}
+
+TEST {{ path = 'a.lua', content = '', }, {
+ path = 'b.lua',
+ content = [[
+---AAA
+G.<?A?> = 1
+
+---BBB
+G.A = 1
+ ]]
+},
+hover = {
+ label = 'global G.A: integer = 1',
+ name = 'G.A',
+ description = 'AAA'
+}}
+
+TEST {{ path = 'a.lua', content = '', }, {
+ path = 'b.lua',
+ content = [[
+---AAA
+G.A = 1
+
+---BBB
+G.<?A?> = 1
+ ]]
+},
+hover = {
+ label = 'global G.A: integer = 1',
+ name = 'G.A',
+ description = 'BBB'
+}}