diff options
author | unknown <sumnekosun@intranet.123u.com> | 2019-04-02 17:33:40 +0800 |
---|---|---|
committer | unknown <sumnekosun@intranet.123u.com> | 2019-04-02 17:33:40 +0800 |
commit | 9151577f9a9b00114e2e0925f510555b12bf54ca (patch) | |
tree | b5ff790f9b5d6466918e7e8ffe071db685a2637d /server/src/core | |
parent | 9ed812cd894a59e709a45bbbc9c5b5149ae7c2bb (diff) | |
download | lua-language-server-9151577f9a9b00114e2e0925f510555b12bf54ca.zip |
修正bug
Diffstat (limited to 'server/src/core')
-rw-r--r-- | server/src/core/completion.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 112e6408..c7ac9310 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -237,10 +237,13 @@ local function searchFields(vm, source, word, callback) map[k] = v end end) - parent:eachLibChild(function (k, v) + parent:eachChild(function (k, v) if map[k] then return end + if not v:getLib() then + return + end if type(k) ~= 'string' then return end @@ -457,7 +460,7 @@ local function searchCallArg(vm, source, word, callback, pos) end end -local function searchAllWords(vm, source, word, callback) +local function searchAllWords(vm, source, word, callback, pos) if word == '' then return end @@ -466,6 +469,7 @@ local function searchAllWords(vm, source, word, callback) end vm:eachSource(function (src) if src.type == 'name' + and not (src.start <= pos and src.finish >= pos) and matchKey(word, src[1]) then callback(src[1], src, CompletionItemKind.Text) @@ -582,7 +586,7 @@ return function (vm, pos, word, oldText) searchSpecial(vm, source, word, callback, pos) searchCallArg(vm, source, word, callback, pos) searchSource(vm, source, word, callback) - searchAllWords(vm, source, word, callback) + searchAllWords(vm, source, word, callback, pos) if #list == 0 then return nil |