Optimize performance

This commit is contained in:
hrsh7th
2022-09-25 21:24:08 +09:00
parent 17a55b3d54
commit e1f31778a8
4 changed files with 13 additions and 11 deletions

View File

@@ -105,13 +105,14 @@ source.get_entries = function(self, ctx)
local inputs = {}
local entries = {}
local matching_config = self:get_matching_config()
for _, e in ipairs(target_entries) do
local o = e:get_offset()
if not inputs[o] then
inputs[o] = string.sub(ctx.cursor_before_line, o)
end
local match = e:match(inputs[o], self:get_matching_config())
local match = e:match(inputs[o], matching_config)
e.score = match.score
e.exact = false
if e.score >= 1 then