Skip to content

Commit 4529b31

Browse files
committed
fix #1370
1 parent 24e213e commit 4529b31

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* `FIX` [#1365](https://github.com/sumneko/lua-language-server/issues/1365)
1010
* `FIX` [#1367](https://github.com/sumneko/lua-language-server/issues/1367)
1111
* `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368)
12+
* `FIX` [#1370](https://github.com/sumneko/lua-language-server/issues/1370)
1213

1314
## 3.5.0
1415
`2022-7-19`

script/parser/luadoc.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,12 +1700,21 @@ local function bindDoc(source, binded)
17001700
goto CONTINUE
17011701
end
17021702
elseif doc.type == 'doc.enum' then
1703-
if source.type ~= 'table' then
1704-
goto CONTINUE
1703+
if source.type == 'table' then
1704+
goto OK
1705+
end
1706+
if source.value and source.value.type == 'table' then
1707+
if not source.value.bindDocs then
1708+
source.value.bindDocs = {}
1709+
end
1710+
source.value.bindDocs[#source.value.bindDocs+1] = doc
1711+
doc.bindSource = source.value
17051712
end
1713+
goto CONTINUE
17061714
elseif doc.type ~= 'doc.comment' then
17071715
goto CONTINUE
17081716
end
1717+
::OK::
17091718
if not source.bindDocs then
17101719
source.bindDocs = {}
17111720
end

test/crossfile/hover.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,3 +1525,32 @@ TEST {
15251525
}
15261526
```]]
15271527
}
1528+
1529+
TEST {
1530+
{
1531+
path = 'a.lua',
1532+
content = [[
1533+
---@enum <?A?>
1534+
local t =
1535+
{
1536+
x = 1,
1537+
y = 2,
1538+
z = 3,
1539+
}
1540+
]]
1541+
},
1542+
hover = [[
1543+
```lua
1544+
(enum) A
1545+
```
1546+
1547+
---
1548+
1549+
```lua
1550+
{
1551+
x: integer = 1,
1552+
y: integer = 2,
1553+
z: integer = 3,
1554+
}
1555+
```]]
1556+
}

0 commit comments

Comments
 (0)