Skip to content

Commit 1074647

Browse files
committed
unless 3 characters
1 parent 4de9d6f commit 1074647

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

script/core/completion.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,16 @@ local function checkCommon(ast, word, text, offset, results)
607607
if not cache.commonWords then
608608
cache.commonWords = {}
609609
local mark = {}
610-
for str in files.getText(uri):gmatch '([%a_][%w_]*)' do
610+
for str in files.getText(uri):gmatch '([%a_][%w_]+)' do
611611
if not mark[str] then
612612
mark[str] = true
613613
cache.commonWords[#cache.commonWords+1] = str
614614
end
615615
end
616616
end
617617
for _, str in ipairs(cache.commonWords) do
618-
if not used[str]
618+
if #str >= 3
619+
and not used[str]
619620
and (str ~= word or not files.eq(myUri, uri)) then
620621
used[str] = true
621622
if matchKey(word, str) then
@@ -630,7 +631,7 @@ local function checkCommon(ast, word, text, offset, results)
630631
for uri in files.eachDll() do
631632
local words = files.getDllWords(uri) or {}
632633
for _, str in ipairs(words) do
633-
if not used[str] and str ~= word then
634+
if #str >= 3 and not used[str] and str ~= word then
634635
used[str] = true
635636
if matchKey(word, str) then
636637
results[#results+1] = {
@@ -642,8 +643,8 @@ local function checkCommon(ast, word, text, offset, results)
642643
end
643644
end
644645
else
645-
for str, pos in text:gmatch '([%a_][%w_]*)()' do
646-
if not used[str] and pos - 1 ~= offset then
646+
for str, pos in text:gmatch '([%a_][%w_]+)()' do
647+
if #str >= 3 and not used[str] and pos - 1 ~= offset then
647648
used[str] = true
648649
if matchKey(word, str) then
649650
results[#results+1] = {

0 commit comments

Comments
 (0)