Skip to content

Commit e191247

Browse files
committed
fix #1608
1 parent e82c09f commit e191247

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
2020
* `FIX` [#1567]
2121
* `FIX` [#1593]
2222
* `FIX` [#1606]
23+
* `FIX` [#1608]
2324

2425
[#1177]: https://github.com/sumneko/lua-language-server/issues/1177
2526
[#1458]: https://github.com/sumneko/lua-language-server/issues/1458
@@ -28,6 +29,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
2829
[#1567]: https://github.com/sumneko/lua-language-server/issues/1567
2930
[#1593]: https://github.com/sumneko/lua-language-server/issues/1593
3031
[#1606]: https://github.com/sumneko/lua-language-server/issues/1606
32+
[#1608]: https://github.com/sumneko/lua-language-server/issues/1608
3133

3234
## 3.5.6
3335
`2022-9-16`

script/parser/luadoc.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ function parseType(parent)
768768
if comments then
769769
resume.comment = table.concat(comments, '\n')
770770
else
771-
resume.comment = nextComm.text:match('#%s*(.+)', #resumeHead + 1)
771+
resume.comment = nextComm.text:match('%s*#?%s*(.+)', resume.finish - nextComm.start)
772772
end
773773
result.types[#result.types+1] = resume
774774
result.finish = resume.finish

test/crossfile/hover.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,3 +1582,27 @@ TEST {
15821582
}
15831583
```]]
15841584
}
1585+
1586+
TEST {
1587+
{
1588+
path = 'a.lua',
1589+
content = [[
1590+
---@alias someType
1591+
---| "#" # description
1592+
1593+
---@type someType
1594+
local <?someValue?>
1595+
]]
1596+
},
1597+
hover = [[
1598+
```lua
1599+
local someValue: "#"
1600+
```
1601+
1602+
---
1603+
1604+
```lua
1605+
someType:
1606+
| "#" -- description
1607+
```]]
1608+
}

0 commit comments

Comments
 (0)