summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-11 21:03:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-11 21:03:16 +0800
commitbaecde8be338fbf2118b2064a8d64c1d5734bb9a (patch)
treefc9ff40dc93f87a2ac5be7b7e9267a2da52054fe /script
parent2469dbae153066fad83edcced82f17aee77d0a9f (diff)
downloadlua-language-server-baecde8be338fbf2118b2064a8d64c1d5734bb9a.zip
resolve #1066
dose not show unknown `---@XXX` as description
Diffstat (limited to 'script')
-rw-r--r--script/core/hover/description.lua24
-rw-r--r--script/parser/luadoc.lua4
2 files changed, 19 insertions, 9 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index c16f271b..4726718d 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -108,11 +108,14 @@ local function lookUpDocComments(source, docGroup)
local lines = {}
for _, doc in ipairs(docGroup) do
if doc.type == 'doc.comment' then
- if doc.comment.text:sub(1, 1) == '-' then
- lines[#lines+1] = doc.comment.text:sub(2)
- else
- lines[#lines+1] = doc.comment.text
+ local comment = doc.comment.text
+ if comment:sub(1, 1) == '-' then
+ comment = comment:sub(2)
end
+ if comment:sub(1, 1) == '@' then
+ goto CONTINUE
+ end
+ lines[#lines+1] = comment
elseif doc.type == 'doc.type' then
if doc.comment then
lines[#lines+1] = doc.comment.text
@@ -126,6 +129,7 @@ local function lookUpDocComments(source, docGroup)
end
end
end
+ ::CONTINUE::
end
if source.comment then
lines[#lines+1] = source.comment.text
@@ -272,11 +276,14 @@ local function getFunctionComment(source)
local md = markdown()
for _, doc in ipairs(docGroup) do
if doc.type == 'doc.comment' then
- if doc.comment.text:sub(1, 1) == '-' then
- md:add('md', doc.comment.text:sub(2))
- else
- md:add('md', doc.comment.text)
+ local comment = doc.comment.text
+ if comment:sub(1, 1) == '-' then
+ comment = comment:sub(2)
+ end
+ if comment:sub(1, 1) == '@' then
+ goto CONTINUE
end
+ md:add('md', comment)
elseif doc.type == 'doc.param' then
if doc.comment then
md:add('md', ('@*param* `%s` — %s'):format(
@@ -309,6 +316,7 @@ local function getFunctionComment(source)
elseif doc.type == 'doc.overload' then
md:splitLine()
end
+ ::CONTINUE::
end
local enums = getBindEnums(source, docGroup)
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 1385d5ce..e8a6d2b3 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -1517,7 +1517,9 @@ local function isContinuedDoc(lastDoc, nextDoc)
end
if lastDoc.type == 'doc.type'
or lastDoc.type == 'doc.module' then
- return false
+ if nextDoc.type ~= 'doc.comment' then
+ return false
+ end
end
if lastDoc.type == 'doc.class'
or lastDoc.type == 'doc.field'