diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/hover/description.lua | 7 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 21 |
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!]] +} |