Skip to content

Commit a7dc2dc

Browse files
authored
Merge pull request #2735 from DCsunset/fix-params
fix: respect showParams config for local function completion
2 parents ebbc372 + 4c03394 commit a7dc2dc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* `NEW` Add postfix snippet for `unpack`
66
* `FIX` `diagnostics.severity` defaulting to "Warning" when run using `--check` [#2730](https://github.com/LuaLS/lua-language-server/issues/2730)
77
* `NEW` Add support for lambda style functions, `|paramList| expr` is syntactic sugar for `function(paramList) return expr end`
8+
* `FIX` Respect `completion.showParams` config for local function completion
89
* `CHG` Improve performance of multithreaded `--check` and `undefined-field` diagnostic
910

1011
## 3.9.3

script/core/completion/completion.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ end
343343

344344
local function checkLocal(state, word, position, results)
345345
local locals = guide.getVisibleLocals(state.ast, position)
346+
local showParams = config.get(state.uri, 'Lua.completion.showParams')
346347
for name, source in util.sortPairs(locals) do
347348
if isSameSource(state, source, position) then
348349
goto CONTINUE
@@ -372,7 +373,12 @@ local function checkLocal(state, word, position, results)
372373
for _, def in ipairs(defs) do
373374
if (def.type == 'function' and not vm.isVarargFunctionWithOverloads(def))
374375
or def.type == 'doc.type.function' then
375-
local funcLabel = name .. getParams(def, false)
376+
local funcLabel
377+
if showParams then
378+
funcLabel = name .. getParams(def, false)
379+
else
380+
funcLabel = name
381+
end
376382
buildFunction(results, source, def, false, {
377383
label = funcLabel,
378384
match = name,

0 commit comments

Comments
 (0)