From e2588c5bd4df6fa2240a4d53dacccbb7ba6557c9 Mon Sep 17 00:00:00 2001 From: kevinhwang91 Date: Wed, 6 Apr 2022 00:42:58 +0800 Subject: [PATCH] chore(postfix): pretty postfix description Under Lua code, we should remove redundant placeholders. Unfortunately, $%d placeholders will result in empty string. --- script/core/completion/postfix.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua index 98bd0639f..c5988ef60 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,