summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/completion.lua10
-rw-r--r--test/completion/init.lua17
2 files changed, 27 insertions, 0 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index a8a881a7..7db106d6 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -1519,6 +1519,11 @@ local function tryLuaDocBySource(ast, offset, source, results)
results[#results+1] = {
label = doc[1],
kind = define.CompletionItemKind.Class,
+ textEdit = doc[1]:find '[^%w_]' and {
+ start = source.start,
+ finish = offset,
+ newText = doc[1],
+ },
}
end
end
@@ -1532,6 +1537,11 @@ local function tryLuaDocBySource(ast, offset, source, results)
results[#results+1] = {
label = doc[1],
kind = define.CompletionItemKind.Class,
+ textEdit = doc[1]:find '[^%w_]' and {
+ start = source.start,
+ finish = offset,
+ newText = doc[1],
+ },
}
end
end
diff --git a/test/completion/init.lua b/test/completion/init.lua
index b07fda90..22103896 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -2524,3 +2524,20 @@ function api(t) end
api({$})
]]
(EXISTS)
+
+TEST [[
+---@class AAA.BBB
+
+---@type AAA.$
+]]
+{
+ {
+ label = 'AAA.BBB',
+ kind = define.CompletionItemKind.Class,
+ textEdit = {
+ start = 29,
+ finish = 32,
+ newText = 'AAA.BBB',
+ },
+ }
+}