diff options
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | script/core/completion.lua | 8 | ||||
-rw-r--r-- | script/core/guide.lua | 2 | ||||
-rw-r--r-- | test/completion/init.lua | 27 |
4 files changed, 37 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md index 371d77cd..f7a1ae3d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 1.21.0 +* `NEW` setting: `completion.showParams` + ## 1.20.5 `2021-4-30` * `NEW` setting: `completion.autoRequire` diff --git a/script/core/completion.lua b/script/core/completion.lua index 624ea0a6..03d17a22 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -505,6 +505,14 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res fields[funcLabel] = src fields[name] = false count = count + 1 + if value.type == 'function' and value.bindDocs then + for _, doc in ipairs(value.bindDocs) do + if doc.type == 'doc.overload' then + funcLabel = name .. getParams(doc.overload, oop) + fields[funcLabel] = doc.overload + end + end + end goto CONTINUE end end diff --git a/script/core/guide.lua b/script/core/guide.lua index 367b91e2..e4871060 100644 --- a/script/core/guide.lua +++ b/script/core/guide.lua @@ -1842,6 +1842,8 @@ function m.checkSameSimpleByBindDocs(status, obj, start, pushQueue, mode) if obj.type == '...' then results[#results+1] = doc end + elseif doc.type == 'doc.overload' then + results[#results+1] = doc.overload end end for _, res in ipairs(results) do diff --git a/test/completion/init.lua b/test/completion/init.lua index ad60b538..d5631564 100644 --- a/test/completion/init.lua +++ b/test/completion/init.lua @@ -1773,9 +1773,6 @@ end) TEST [[ --- JustTest ----@overload fun(list:table):string ----@overload fun(list:table, sep:string):string ----@overload fun(list:table, sep:string, i:number):string ---@param list table ---@param sep string ---@param i number @@ -2477,3 +2474,27 @@ TEST [[ }, } } + +TEST [[ +---@overload fun(a: any, b: any) +local function zzzz(a) end +zzzz$ +]] +{ + { + label = 'zzzz(a)', + kind = define.CompletionItemKind.Function, + }, + { + label = 'zzzz(a)', + kind = define.CompletionItemKind.Snippet, + }, + { + label = 'zzzz(a, b)', + kind = define.CompletionItemKind.Function, + }, + { + label = 'zzzz(a, b)', + kind = define.CompletionItemKind.Snippet, + }, +} |