diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:14:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 16:14:01 +0800 |
commit | aa8982b66537e59822d4717f446de3e5dd83e72b (patch) | |
tree | 906403936f8816fb21ec75847bd32b9ad7b91b1a /script/core | |
parent | a6fc1ae6fb30a04026518601623278434d474f0c (diff) | |
download | lua-language-server-aa8982b66537e59822d4717f446de3e5dd83e72b.zip |
fix hints
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/hint.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/script/core/hint.lua b/script/core/hint.lua index 41f59d02..4050ccf9 100644 --- a/script/core/hint.lua +++ b/script/core/hint.lua @@ -70,9 +70,6 @@ local function getArgNames(func) return nil end local names = {} - if func.parent.type == 'setmethod' then - names[#names+1] = 'self' - end for _, arg in ipairs(func.args) do if arg.type == '...' then break @@ -114,6 +111,9 @@ local function paramName(uri, edits, start, finish) if paramConfig == 'Literal' and not hasLiteralArgInCall(source) then return end + if not source.args then + return + end await.delay() local defs = vm.getDefs(source.node) if not defs then @@ -134,10 +134,12 @@ local function paramName(uri, edits, start, finish) if not args then return end + local firstIndex = 1 if source.node and source.node.type == 'getmethod' then - table.remove(args, 1) + firstIndex = 2 end - for i, arg in ipairs(source.args) do + for i = firstIndex, #source.args do + local arg = source.args[i] if not mark[arg] and (paramConfig ~= 'Literal' or guide.isLiteral(arg)) then mark[arg] = true |