summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-26 19:40:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-26 19:40:48 +0800
commit79bf3e605d282cdbe425eea1b5793fc97d8404da (patch)
tree8600103127c10d419a50fbd97933069b3b853a27 /script/core
parent55b303d0beb1b08b5a50488e0bbba075a49d965d (diff)
downloadlua-language-server-79bf3e605d282cdbe425eea1b5793fc97d8404da.zip
close #135 param comment
Diffstat (limited to 'script/core')
-rw-r--r--script/core/hover/description.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 0e4dd9a7..2fac0d99 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -198,11 +198,38 @@ local function tryDocOverloadToComment(source)
end
end
+local function tyrDocParamComment(source)
+ if source.type == 'setlocal'
+ or source.type == 'getlocal' then
+ source = source.node
+ end
+ if source.type ~= 'local' then
+ return
+ end
+ if source.parent.type ~= 'funcargs' then
+ return
+ end
+ if not source.bindDocs then
+ return
+ end
+ for _, doc in ipairs(source.bindDocs) do
+ if doc.type == 'doc.param' then
+ if doc.param[1] == source[1] then
+ if doc.comment then
+ return doc.comment.text
+ end
+ break
+ end
+ end
+ end
+end
+
return function (source)
if source.type == 'string' then
return asString(source)
end
return tryDocOverloadToComment(source)
or tryDocFieldUpComment(source)
+ or tyrDocParamComment(source)
or tryDocComment(source)
end