summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/parser/luadoc.lua2
-rw-r--r--test/crossfile/hover.lua24
3 files changed, 27 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 403d7e00..92967c83 100644
--- a/changelog.md
+++ b/changelog.md
@@ -20,6 +20,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
* `FIX` [#1567]
* `FIX` [#1593]
* `FIX` [#1606]
+* `FIX` [#1608]
[#1177]: https://github.com/sumneko/lua-language-server/issues/1177
[#1458]: https://github.com/sumneko/lua-language-server/issues/1458
@@ -28,6 +29,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
[#1567]: https://github.com/sumneko/lua-language-server/issues/1567
[#1593]: https://github.com/sumneko/lua-language-server/issues/1593
[#1606]: https://github.com/sumneko/lua-language-server/issues/1606
+[#1608]: https://github.com/sumneko/lua-language-server/issues/1608
## 3.5.6
`2022-9-16`
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index d5ac93bb..58f70028 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -768,7 +768,7 @@ function parseType(parent)
if comments then
resume.comment = table.concat(comments, '\n')
else
- resume.comment = nextComm.text:match('#%s*(.+)', #resumeHead + 1)
+ resume.comment = nextComm.text:match('%s*#?%s*(.+)', resume.finish - nextComm.start)
end
result.types[#result.types+1] = resume
result.finish = resume.finish
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index e6517aa9..c3d7078c 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -1582,3 +1582,27 @@ TEST {
}
```]]
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ ---@alias someType
+ ---| "#" # description
+
+ ---@type someType
+ local <?someValue?>
+ ]]
+ },
+ hover = [[
+```lua
+local someValue: "#"
+```
+
+---
+
+```lua
+someType:
+ | "#" -- description
+```]]
+}