diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-03 19:13:01 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-03 19:13:01 +0800 |
commit | 289a780f38c24a7ee0f4ca9502214b41fe11fc30 (patch) | |
tree | 394a8b94a072b6f567a6918150cb683d8ecaef96 /server/src/core | |
parent | b1f9435c0bc21fb2d27677745e7726c9333b3c06 (diff) | |
download | lua-language-server-289a780f38c24a7ee0f4ca9502214b41fe11fc30.zip |
自动完成的 child 过滤关键字
Diffstat (limited to 'server/src/core')
-rw-r--r-- | server/src/core/completion.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 2204c369..83f684f3 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -30,6 +30,12 @@ local CompletionItemKind = { TypeParameter = 25, } +local KEYS = {'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', 'toclose'} +local KEYMAP = {} +for _, k in ipairs(KEYS) do + KEYMAP[k] = true +end + local function matchKey(me, other) if me == other then return true @@ -223,6 +229,9 @@ local function searchFields(vm, source, word, callback) if map[k] then return end + if KEYMAP[k] then + return + end if info.type ~= 'set child' and info.type ~= 'get child' then return end @@ -244,6 +253,9 @@ local function searchFields(vm, source, word, callback) if map[k] then return end + if KEYMAP[k] then + return + end if not v:getLib() then return end @@ -292,7 +304,6 @@ local function searchCloseGlobal(vm, source, word, callback) end) end -local KEYS = {'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', 'toclose'} local function searchKeyWords(vm, source, word, callback) for _, key in ipairs(KEYS) do if matchKey(word, key) then |