diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 20:17:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-08 20:17:04 +0800 |
commit | 9585ac191f61d72dd198edec139b955276a53072 (patch) | |
tree | 8497952d1ea937cae6a8e4959a1e39223d86fc94 /script/core | |
parent | 90763c00c9960a8776e046c45a9f87d348ebc3d1 (diff) | |
download | lua-language-server-9585ac191f61d72dd198edec139b955276a53072.zip |
resolve #708 resolve #767
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/diagnostics/undefined-doc-param.lua | 3 | ||||
-rw-r--r-- | script/core/hover/arg.lua | 17 | ||||
-rw-r--r-- | script/core/infer.lua | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/script/core/diagnostics/undefined-doc-param.lua b/script/core/diagnostics/undefined-doc-param.lua index 6140b4f0..86bf3871 100644 --- a/script/core/diagnostics/undefined-doc-param.lua +++ b/script/core/diagnostics/undefined-doc-param.lua @@ -12,6 +12,9 @@ local function hasParamName(func, name) if arg[1] == name then return true end + if arg.type == '...' and name == '...' then + return true + end end return false end diff --git a/script/core/hover/arg.lua b/script/core/hover/arg.lua index 822be2b6..5963ad97 100644 --- a/script/core/hover/arg.lua +++ b/script/core/hover/arg.lua @@ -60,18 +60,11 @@ local function asDocFunction(source) for i = 1, #source.args do local arg = source.args[i] local name = arg.name[1] - if arg.extends then - args[i] = ('%s%s: %s'):format( - name, - arg.optional and '?' or '', - infer.searchAndViewInfers(arg.extends) - ) - else - args[i] = ('%s%s'):format( - name, - arg.optional and '?' or '' - ) - end + args[i] = ('%s%s: %s'):format( + name, + arg.optional and '?' or '', + arg.extends and infer.searchAndViewInfers(arg.extends) or 'any' + ) end return table.concat(args, ', ') end diff --git a/script/core/infer.lua b/script/core/infer.lua index 6e667e65..36bf740d 100644 --- a/script/core/infer.lua +++ b/script/core/infer.lua @@ -385,7 +385,7 @@ function m.viewDocFunction(doc) end local args = {} for i, arg in ipairs(doc.args) do - args[i] = ('%s: %s'):format(arg.name[1], m.viewDocName(arg.extends)) + args[i] = ('%s: %s'):format(arg.name[1], arg.extends and m.viewDocName(arg.extends) or 'any') end local label = ('fun(%s)'):format(table.concat(args, ', ')) if #doc.returns > 0 then |