summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-28 14:45:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-28 14:45:55 +0800
commit2220abed24856f8f6265b6126de128540c429dea (patch)
treeef7f3a98669e88d257d81a2e66fc1d197828d398 /server
parent4cd3ac36e3756a5e200c8cd3d1b597f04253fb5d (diff)
downloadlua-language-server-2220abed24856f8f6265b6126de128540c429dea.zip
特殊处理一下 local function 的片段
Diffstat (limited to 'server')
-rw-r--r--server/src/core/completion.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index d5078a07..5b30a57c 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -461,6 +461,12 @@ local function searchAsLocal(vm, source, word, callback)
-- 特殊支持 local function
if matchKey(word, 'function') then
callback('function', nil, CompletionItemKind.Keyword)
+ -- TODO 需要有更优美的实现方式
+ local data = snippet.key['function'][1]
+ callback(data.label, nil, CompletionItemKind.Snippet, {
+ insertTextFormat = 2,
+ insertText = data.text,
+ })
end
end