diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/config/config.lua | 2 | ||||
-rw-r--r-- | script/core/hint.lua | 8 |
3 files changed, 7 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md index 0200e159..6d2c1259 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # changelog ## 2.4.0 +* `CHG` hint: `Lua.hint.paramName` now supports `Disable`, `Literal` and `All` * `FIX` runtime errors ## 2.3.7 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] = { |