diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 13 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 29 |
3 files changed, 41 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index 6e6b4b61..a9e12f22 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ * `FIX` [#1365](https://github.com/sumneko/lua-language-server/issues/1365) * `FIX` [#1367](https://github.com/sumneko/lua-language-server/issues/1367) * `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368) +* `FIX` [#1370](https://github.com/sumneko/lua-language-server/issues/1370) ## 3.5.0 `2022-7-19` diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index d13120b6..51161565 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1700,12 +1700,21 @@ local function bindDoc(source, binded) goto CONTINUE end elseif doc.type == 'doc.enum' then - if source.type ~= 'table' then - goto CONTINUE + if source.type == 'table' then + goto OK + end + if source.value and source.value.type == 'table' then + if not source.value.bindDocs then + source.value.bindDocs = {} + end + source.value.bindDocs[#source.value.bindDocs+1] = doc + doc.bindSource = source.value end + goto CONTINUE elseif doc.type ~= 'doc.comment' then goto CONTINUE end + ::OK:: if not source.bindDocs then source.bindDocs = {} end diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index d1148309..e8a718d4 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1525,3 +1525,32 @@ TEST { } ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@enum <?A?> + local t = + { + x = 1, + y = 2, + z = 3, + } + ]] + }, + hover = [[ +```lua +(enum) A +``` + +--- + +```lua +{ + x: integer = 1, + y: integer = 2, + z: integer = 3, +} +```]] +} |