This commit is contained in:
hrsh7th
2022-11-23 23:44:01 +09:00
parent 8a9e8a89ee
commit 31a145c866

View File

@@ -384,8 +384,9 @@ entry.match = function(self, input, matching_config)
}, },
} }
local score, matches, _ local score, matches, filter_text, _
score, matches = matcher.match(input, self:get_filter_text(), option) filter_text = self:get_filter_text()
score, matches = matcher.match(input, filter_text, option)
-- Support the language server that doesn't respect VSCode's behaviors. -- Support the language server that doesn't respect VSCode's behaviors.
if score == 0 then if score == 0 then
@@ -397,14 +398,17 @@ entry.match = function(self, input, matching_config)
accept = accept or string.match(prefix, '^[^%a]+$') accept = accept or string.match(prefix, '^[^%a]+$')
accept = accept or string.find(self:get_completion_item().textEdit.newText, prefix, 1, true) accept = accept or string.find(self:get_completion_item().textEdit.newText, prefix, 1, true)
if accept then if accept then
score, matches = matcher.match(input, prefix .. self:get_filter_text(), option) filter_text = prefix .. self:get_filter_text()
score, matches = matcher.match(input, filter_text, option)
end end
end end
end end
end end
if self:get_filter_text() ~= self:get_completion_item().label then local vim_item = self:get_vim_item(self:get_offset())
_, matches = matcher.match(input, self:get_completion_item().label, { synonyms = { self:get_word() } }) if filter_text ~= vim_item.abbr then
filter_text = vim_item.abbr or vim_item.word
_, matches = matcher.match(input, filter_text, option)
end end
return { score = score, matches = matches } return { score = score, matches = matches }