summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
authorkevinhwang91 <kevin.hwang@live.com>2022-04-09 01:15:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-09 01:46:24 +0800
commit4bf314156de18f08406953ae7ed8bf048102a0bb (patch)
treeb112de41535361bce1adc745ea853f5bbdcb428d /script/core
parent097a36edf4cece5ce1b590adffc6de0d2929e995 (diff)
downloadlua-language-server-4bf314156de18f08406953ae7ed8bf048102a0bb.zip
fix(completion): push (#1022) to 3.0
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion/completion.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index 471566b3..e6f07b7b 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -1414,11 +1414,23 @@ local function tryCallArg(state, position, results)
}
end
if src.type == 'doc.type.function' then
+ local insertText = buildInsertDocFunction(src)
+ local description
+ if src.comment then
+ description = src.comment
+ else
+ local descText = insertText:gsub('%$%{%d+:([^}]+)%}', function (val)
+ return val
+ end):gsub('%$%{?%d+%}?', '')
+ description = markdown()
+ : add('lua', descText)
+ : string()
+ end
enums[#enums+1] = {
label = infer.getInfer(src):view(),
- description = src.comment,
+ description = description,
kind = define.CompletionItemKind.Function,
- insertText = buildInsertDocFunction(src),
+ insertText = insertText,
}
end
end