Skip to content

Commit e18678a

Browse files
kevinhwang91sumneko
authored andcommitted
chore(postfix): pretty postfix description
Under Lua code, we should remove redundant placeholders. Unfortunately, $%d placeholders will result in empty string.
1 parent 63b3606 commit e18678a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

script/core/completion/postfix.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,14 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
297297
for i, action in ipairs(actions) do
298298
if matchKey(word, action.key) then
299299
action.data[1](state, source, function (newText)
300+
local descText = newText:gsub('%$%{%d+:([^}]+)%}', function (val)
301+
return val
302+
end):gsub('%$%{?%d+%}?', '')
300303
results[#results+1] = {
301304
label = action.key,
302305
kind = define.CompletionItemKind.Event,
303306
description = markdown()
304-
: add('lua', newText)
307+
: add('lua', descText)
305308
: string(),
306309
textEdit = {
307310
start = wordPosition + #symbol,

0 commit comments

Comments
 (0)