summaryrefslogtreecommitdiff
path: root/script/core/completion
diff options
context:
space:
mode:
authorkevinhwang91 <kevin.hwang@live.com>2022-04-06 00:42:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-06 01:03:55 +0800
commite18678a58b10ada0120b4e6d4f8c332d7f16bc4a (patch)
tree1e18725fc08c7b930e718331d70bb8b8d63404ad /script/core/completion
parent63b360689f0c2c99a1ae410518f6866f49972f98 (diff)
downloadlua-language-server-e18678a58b10ada0120b4e6d4f8c332d7f16bc4a.zip
chore(postfix): pretty postfix description
Under Lua code, we should remove redundant placeholders. Unfortunately, $%d placeholders will result in empty string.
Diffstat (limited to 'script/core/completion')
-rw-r--r--script/core/completion/postfix.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua
index 98bd0639..c5988ef6 100644
--- a/script/core/completion/postfix.lua
+++ b/script/core/completion/postfix.lua
@@ -297,11 +297,14 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
for i, action in ipairs(actions) do
if matchKey(word, action.key) then
action.data[1](state, source, function (newText)
+ local descText = newText:gsub('%$%{%d+:([^}]+)%}', function (val)
+ return val
+ end):gsub('%$%{?%d+%}?', '')
results[#results+1] = {
label = action.key,
kind = define.CompletionItemKind.Event,
description = markdown()
- : add('lua', newText)
+ : add('lua', descText)
: string(),
textEdit = {
start = wordPosition + #symbol,