diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 14:49:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 14:49:41 +0800 |
commit | f0b9fdb56762a95bdb568e2fcc15ce96bb97ca7c (patch) | |
tree | f5e868739e19ab99afe59fb77f7f1ca815c2415d /script | |
parent | e3b50c1af79dac4892cc0a4725c39da187142cc6 (diff) | |
download | lua-language-server-f0b9fdb56762a95bdb568e2fcc15ce96bb97ca7c.zip |
`Lua.hint.paramName` supports all params
Diffstat (limited to 'script')
-rw-r--r-- | script/config/config.lua | 2 | ||||
-rw-r--r-- | script/core/hint.lua | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index d6919c65..512b954c 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -192,7 +192,7 @@ local Template = { ['Lua.hint.enable'] = Type.Boolean >> false, ['Lua.hint.paramType'] = Type.Boolean >> true, ['Lua.hint.setType'] = Type.Boolean >> false, - ['Lua.hint.paramName'] = Type.Boolean >> true, + ['Lua.hint.paramName'] = Type.String >> 'All', ['Lua.window.statusBar'] = Type.Boolean >> true, ['Lua.window.progressBar'] = Type.Boolean >> true, ['Lua.telemetry.enable'] = Type.Or(Type.Boolean >> false, Type.Nil), diff --git a/script/core/hint.lua b/script/core/hint.lua index fe86c2a3..41f59d02 100644 --- a/script/core/hint.lua +++ b/script/core/hint.lua @@ -98,7 +98,8 @@ local function hasLiteralArgInCall(call) end local function paramName(uri, edits, start, finish) - if not config.get 'Lua.hint.paramName' then + local paramConfig = config.get 'Lua.hint.paramName' + if not paramConfig or paramConfig == 'None' then return end local ast = files.getState(uri) @@ -110,7 +111,7 @@ local function paramName(uri, edits, start, finish) if source.type ~= 'call' then return end - if not hasLiteralArgInCall(source) then + if paramConfig == 'Literal' and not hasLiteralArgInCall(source) then return end await.delay() @@ -137,7 +138,8 @@ local function paramName(uri, edits, start, finish) table.remove(args, 1) end for i, arg in ipairs(source.args) do - if not mark[arg] and guide.isLiteral(arg) then + if not mark[arg] + and (paramConfig ~= 'Literal' or guide.isLiteral(arg)) then mark[arg] = true if args[i] and args[i] ~= '' then edits[#edits+1] = { |