summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-02-08 22:50:27 +0800
committersumneko <sumneko@hotmail.com>2022-02-08 22:50:27 +0800
commit86237012d5b80833d64547199c167db263626a2c (patch)
treeec7973fb21a2582445e259d6d29803b2bb2a301a
parent007e8637827b75d95f188df0f1c3173cabc53a8b (diff)
downloadlua-language-server-86237012d5b80833d64547199c167db263626a2c.zip
reduced sorting priority for postfix completion
-rw-r--r--changelog.md1
-rw-r--r--script/core/completion/postfix.lua3
-rw-r--r--script/provider/provider.lua2
3 files changed, 4 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 64c775c7..2e386d6d 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,7 @@
# changelog
## 2.6.4
+* `CHG` completion: reduced sorting priority for postfix completion
* `FIX` [#937](https://github.com/sumneko/lua-language-server/issues/937)
* `FIX` [#941](https://github.com/sumneko/lua-language-server/issues/941)
diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua
index 2ac24933..984ad03c 100644
--- a/script/core/completion/postfix.lua
+++ b/script/core/completion/postfix.lua
@@ -240,7 +240,7 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
if not source then
return
end
- for _, action in ipairs(actions) do
+ for i, action in ipairs(actions) do
if matchKey(word, action.key) then
action.data[1](state, source, function (newText)
results[#results+1] = {
@@ -261,6 +261,7 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
newText = '',
},
},
+ sortText = ('postfix-%04d'):format(i),
}
end)
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index dc267dae..bd0dd826 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -535,7 +535,7 @@ m.register 'textDocument/completion' {
kind = res.kind,
detail = res.detail,
deprecated = res.deprecated,
- sortText = ('%04d'):format(i),
+ sortText = res.sortText or ('%04d'):format(i),
filterText = res.filterText,
insertText = res.insertText,
insertTextFormat = 2,