diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:44:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:44:11 +0800 |
commit | 062e14378dcf2c5dd1869cba4ceec70ed4f89997 (patch) | |
tree | 20b163a350ca0c0c298c7f45c5044345d437b551 | |
parent | 7f9a7b7a8027e94fcb0a3ece3b8de1bf75d20020 (diff) | |
download | lua-language-server-062e14378dcf2c5dd1869cba4ceec70ed4f89997.zip |
small improve
-rw-r--r-- | script/core/completion.lua | 5 | ||||
-rw-r--r-- | script/core/matchkey.lua | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 61d44663..07f36926 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1703,7 +1703,7 @@ local function makeCache(uri, offset, results) end local text = files.getText(uri) local word = findWord(text, offset) - if not word then + if not word or #word < 2 then cache.results = nil return end @@ -1730,7 +1730,7 @@ local function getCache(uri, offset) local results = cache.results for i = #results, 1, -1 do local res = results[i] - if res.type == define.CompletionItemKind.Text then + if res.kind == define.CompletionItemKind.Text then results[i] = results[#results] results[#results] = nil end @@ -1779,6 +1779,7 @@ local function completion(uri, offset) clearCache() return nil end + makeCache(uri, offset, results) return results end diff --git a/script/core/matchkey.lua b/script/core/matchkey.lua index b504fb1d..24e1ca41 100644 --- a/script/core/matchkey.lua +++ b/script/core/matchkey.lua @@ -13,7 +13,7 @@ return function (input, other, fast) if lMe == lOther:sub(1, #lMe) then return true end - if fast and input:sub(1, 1) ~= other:sub(1, 1) then + if (fast or #input == 1) and input:sub(1, 1) ~= other:sub(1, 1) then return false end local chars = {} |