summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/completion/completion.lua16
-rw-r--r--test/completion/common.lua6
2 files changed, 20 insertions, 2 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index 06b46de9..53a80fc3 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -1349,11 +1349,23 @@ local function pushCallEnumsAndFuncs(defs)
}
end
if def.type == 'doc.type.function' then
+ local insertText = buildInsertDocFunction(def)
+ local description
+ if def.comment then
+ description = def.comment
+ else
+ local descText = insertText:gsub('%$%{%d+:([^}]+)%}', function (val)
+ return val
+ end):gsub('%$%{?%d+%}?', '')
+ description = markdown()
+ : add('lua', descText)
+ : string()
+ end
results[#results+1] = {
label = infer.viewDocFunction(def),
- description = def.comment,
+ description = description,
kind = define.CompletionItemKind.Function,
- insertText = buildInsertDocFunction(def),
+ insertText = insertText,
}
end
end
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 58b27fe7..8128d2ab 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -1895,6 +1895,12 @@ f(<??>)
function (${1:x}, ${2:y})\
\t$0\
end",
+ description = "\z
+```lua\
+function (x, y)\
+\t\
+end\
+```"
},
}