diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-04-06 16:08:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-04-06 16:08:26 +0800 |
commit | 66600bb4855fcb327ef160bdf2b79f6017c0ec9c (patch) | |
tree | 0745778fc824163941210bcbfe15f4ec251e34c3 /script/core/hint.lua | |
parent | 0e0421c29ea3c829ef98fc00e890e80666cece73 (diff) | |
download | lua-language-server-66600bb4855fcb327ef160bdf2b79f6017c0ec9c.zip |
mark hint
Diffstat (limited to 'script/core/hint.lua')
-rw-r--r-- | script/core/hint.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/script/core/hint.lua b/script/core/hint.lua index f2ef772d..13d01dc7 100644 --- a/script/core/hint.lua +++ b/script/core/hint.lua @@ -8,6 +8,7 @@ local function typeHint(uri, edits, start, finish) if not ast then return end + local mark = {} guide.eachSourceBetween(ast.ast, start, finish, function (source) if source.type ~= 'local' and source.type ~= 'setglobal' @@ -46,6 +47,10 @@ local function typeHint(uri, edits, start, finish) if not src then return end + if mark[src] then + return + end + mark[src] = true edits[#edits+1] = { newText = (':%s'):format(infer), start = src.finish, @@ -94,6 +99,7 @@ local function paramName(uri, edits, start, finish) if not ast then return end + local mark = {} guide.eachSourceBetween(ast.ast, start, finish, function (source) if source.type ~= 'call' then return @@ -124,7 +130,8 @@ local function paramName(uri, edits, start, finish) table.remove(args, 1) end for i, arg in ipairs(source.args) do - if guide.isLiteral(arg) then + if not mark[arg] and guide.isLiteral(arg) then + mark[arg] = true if args[i] and args[i] ~= '' then edits[#edits+1] = { newText = ('%s:'):format(args[i]), |