summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-05-23 20:14:00 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-05-23 20:14:00 +0800
commit5c4fbc76835f9f31e04b4f99778dea5c63b84d8e (patch)
tree839c716477cc3c7b09e7fc2917d3c462d1a28f9d
parentfd4336161730b79c1d8fecf42a681037f89f6c01 (diff)
downloadlua-language-server-5c4fbc76835f9f31e04b4f99778dea5c63b84d8e.zip
fix #1125
-rw-r--r--changelog.md1
-rw-r--r--script/core/hover/description.lua7
-rw-r--r--test/crossfile/hover.lua21
3 files changed, 25 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md
index 9b202683..097d692b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 3.2.4
* `FIX` hover: can not union `table` with other basic types
+* `FIX` [#1125](https://github.com/sumneko/lua-language-server/issues/1125)
## 3.2.3
`2022-5-16`
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index e9267c0f..712ea1ad 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -229,14 +229,13 @@ local function getBindEnums(source, docGroup)
end
local function tryDocFieldUpComment(source)
- if source.type ~= 'doc.field.name' then
+ if source.type ~= 'doc.field' then
return
end
- local docField = source.parent
- if not docField.bindGroup then
+ if not source.bindGroup then
return
end
- local comment = getBindComment(docField, docField.bindGroup, docField)
+ local comment = getBindComment(source, source.bindGroup, source)
return comment
end
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index 09eceb43..0bf8165b 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -1137,3 +1137,24 @@ TEST {
(async) (method) C:f(a: any)
```]]
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ ---@class Apple
+ ---The color of your awesome apple!
+ ---@field color string
+ local Apple = {}
+
+ Apple.<?color?>
+ ]]
+ },
+ hover = [[
+```lua
+(field) Apple.color: string
+```
+
+---
+The color of your awesome apple!]]
+}