diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-16 15:32:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-16 15:32:36 +0800 |
commit | e5bcfb04cd32045aaea778752350ea6ed0725953 (patch) | |
tree | 2366317b25433110819c8a63a72f7f1ee5228e53 /server/src/core | |
parent | eb57da9aa226890bf40d6187811227f5150fb1b1 (diff) | |
download | lua-language-server-e5bcfb04cd32045aaea778752350ea6ed0725953.zip |
自动完成也能使用所有符号
Diffstat (limited to 'server/src/core')
-rw-r--r-- | server/src/core/completion.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 9e7b72ab..5bf55053 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -461,6 +461,19 @@ local function searchInResult(result, source, vm, pos, callback) end end +local function searchAllWords(result, vm, callback) + if result.key == '' then + return + end + for source in pairs(vm.results.sources) do + if source.type == 'name' then + if result.key ~= source[1] and matchKey(result.key, source[1]) then + callback(source[1], CompletionItemKind.Text) + end + end + end +end + local function searchSpecial(vm, pos, callback) -- 尝试 # local result, source = findResult(vm, pos, 2) @@ -532,6 +545,7 @@ return function (vm, pos) if result then callback = makeList(list, source) searchInResult(result, source, vm, pos, callback) + searchAllWords(result, vm, callback) clearList(list, source) end end |