diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-03 19:00:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-03 19:00:33 +0800 |
commit | 03b763eb9aab5eebf1ac11481794e95a2e2af9ef (patch) | |
tree | 4de222d29572bc3c5bd6c78e71c53792deac2eba /script-beta | |
parent | a9875d31fd5097a28099096fec7ebe773285629e (diff) | |
download | lua-language-server-03b763eb9aab5eebf1ac11481794e95a2e2af9ef.zip |
overload 继承 doc.comment
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/hover/description.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/script-beta/core/hover/description.lua b/script-beta/core/hover/description.lua index b6d46edb..ea2486a1 100644 --- a/script-beta/core/hover/description.lua +++ b/script-beta/core/hover/description.lua @@ -188,6 +188,8 @@ local function tryDocComment(source) for _, doc in ipairs(source.bindDocs) do if doc.type == 'doc.comment' then lines[#lines+1] = doc.comment.text:sub(2) + elseif #lines > 0 then + break end end if #lines == 0 then @@ -198,10 +200,28 @@ local function tryDocComment(source) return md:string() end +local function tryDocOverloadToComment(source) + if source.type ~= 'doc.type.function' then + return + end + local doc = source.parent + if doc.type ~= 'doc.overload' + or not doc.bindSources then + return + end + for _, src in ipairs(doc.bindSources) do + local md = tryDocComment(src) + if md then + return md + end + end +end + return function (source) if source.type == 'string' then return asString(source) end return tryLibrary(source) + or tryDocOverloadToComment(source) or tryDocComment(source) end |