summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-07-01 15:06:15 +0800
committerGitHub <noreply@github.com>2024-07-01 15:06:15 +0800
commita7dc2dc9eebfdfa4a8c224db801fd60794843135 (patch)
treea425dde30a599f9fd561a3737d27335238c9b2d2
parentebbc372f6754f458e7ac9b08655ce79737868aea (diff)
parent4c03394901e88e9c09a40667e561093a155fa169 (diff)
downloadlua-language-server-a7dc2dc9eebfdfa4a8c224db801fd60794843135.zip
Merge pull request #2735 from DCsunset/fix-params
fix: respect showParams config for local function completion
-rw-r--r--changelog.md1
-rw-r--r--script/core/completion/completion.lua8
2 files changed, 8 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index d777fdc0..87ef33ef 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,7 @@
* `NEW` Add postfix snippet for `unpack`
* `FIX` `diagnostics.severity` defaulting to "Warning" when run using `--check` [#2730](https://github.com/LuaLS/lua-language-server/issues/2730)
* `NEW` Add support for lambda style functions, `|paramList| expr` is syntactic sugar for `function(paramList) return expr end`
+* `FIX` Respect `completion.showParams` config for local function completion
* `CHG` Improve performance of multithreaded `--check` and `undefined-field` diagnostic
## 3.9.3
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index 3a76472a..866d6590 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -343,6 +343,7 @@ end
local function checkLocal(state, word, position, results)
local locals = guide.getVisibleLocals(state.ast, position)
+ local showParams = config.get(state.uri, 'Lua.completion.showParams')
for name, source in util.sortPairs(locals) do
if isSameSource(state, source, position) then
goto CONTINUE
@@ -372,7 +373,12 @@ local function checkLocal(state, word, position, results)
for _, def in ipairs(defs) do
if (def.type == 'function' and not vm.isVarargFunctionWithOverloads(def))
or def.type == 'doc.type.function' then
- local funcLabel = name .. getParams(def, false)
+ local funcLabel
+ if showParams then
+ funcLabel = name .. getParams(def, false)
+ else
+ funcLabel = name
+ end
buildFunction(results, source, def, false, {
label = funcLabel,
match = name,