diff options
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/completion.lua | 27 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 2 |
2 files changed, 21 insertions, 8 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 54f96295..16b2ad4c 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -488,14 +488,25 @@ local function searchSpecial(vm, source, word, callback, pos) end end -- 4. 创建代码片段 - local label = table.concat(chars) .. '+1' - callback(label, nil, CompletionItemKind.Snippet, { - textEdit = { - start = inside.start + 1, - finish = index.finish, - newText = ('%s] = '):format(label), - }, - }) + if simple:get 'as action' then + local label = table.concat(chars) .. '+1' + callback(label, nil, CompletionItemKind.Snippet, { + textEdit = { + start = inside.start + 1, + finish = index.finish, + newText = ('%s] = '):format(label), + }, + }) + else + local label = table.concat(chars) + callback(label, nil, CompletionItemKind.Snippet, { + textEdit = { + start = inside.start + 1, + finish = index.finish, + newText = ('%s]'):format(label), + }, + }) + end end local function makeList(source, word) diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 77f428ae..332f4a69 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -974,6 +974,7 @@ function mt:doAction(action) elseif tp == 'simple' then -- call self:getSimple(action) + action:set('as action', true) elseif tp == 'if' then self:doIf(action) elseif tp == 'loop' then @@ -990,6 +991,7 @@ function mt:doAction(action) self:doLocalFunction(action) else self:getExp(action) + action:set('as action', true) end end |