diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-04 17:34:22 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-04 17:34:22 +0800 |
commit | 107464763417eee478fc73d31678f916f0b5383e (patch) | |
tree | 638f02a87ecac34eaf6313101343c071324f3f1b /script | |
parent | 4de9d6fe6867e1aa079b7187c1252514a4e603e5 (diff) | |
download | lua-language-server-107464763417eee478fc73d31678f916f0b5383e.zip |
unless 3 characters
Diffstat (limited to 'script')
-rw-r--r-- | script/core/completion.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index a36cf8f4..7fa9855b 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -607,7 +607,7 @@ local function checkCommon(ast, word, text, offset, results) if not cache.commonWords then cache.commonWords = {} local mark = {} - for str in files.getText(uri):gmatch '([%a_][%w_]*)' do + for str in files.getText(uri):gmatch '([%a_][%w_]+)' do if not mark[str] then mark[str] = true cache.commonWords[#cache.commonWords+1] = str @@ -615,7 +615,8 @@ local function checkCommon(ast, word, text, offset, results) end end for _, str in ipairs(cache.commonWords) do - if not used[str] + if #str >= 3 + and not used[str] and (str ~= word or not files.eq(myUri, uri)) then used[str] = true if matchKey(word, str) then @@ -630,7 +631,7 @@ local function checkCommon(ast, word, text, offset, results) for uri in files.eachDll() do local words = files.getDllWords(uri) or {} for _, str in ipairs(words) do - if not used[str] and str ~= word then + if #str >= 3 and not used[str] and str ~= word then used[str] = true if matchKey(word, str) then results[#results+1] = { @@ -642,8 +643,8 @@ local function checkCommon(ast, word, text, offset, results) end end else - for str, pos in text:gmatch '([%a_][%w_]*)()' do - if not used[str] and pos - 1 ~= offset then + for str, pos in text:gmatch '([%a_][%w_]+)()' do + if #str >= 3 and not used[str] and pos - 1 ~= offset then used[str] = true if matchKey(word, str) then results[#results+1] = { |