From dcad32ab5e935bf3042208803c09f5fc8b25adc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=94=E8=B5=A4?= Date: Wed, 17 Jan 2024 21:57:47 +0800 Subject: [PATCH] speedup --- lua/easycomplete.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/easycomplete.lua b/lua/easycomplete.lua index 69ba788..941c81a 100644 --- a/lua/easycomplete.lua +++ b/lua/easycomplete.lua @@ -187,11 +187,16 @@ function EasyComplete.filter(match_list, needle) for _, item in ipairs(match_list) do if #item < #needle then -- pass + goto continue elseif item == needle then -- pass - elseif string.find(string.lower(item), "^" .. string.lower(needle)) ~= nil then + goto continue + end + local idx = string.find(string.lower(item), "" .. string.lower(needle)) + if type(idx) == type(2) and idx <= 3 then table.insert(result, item) end + ::continue:: end return result end