From 3a51a8ec7be01bf7725532b6b367d429ed7331db Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Sun, 10 Oct 2021 11:57:02 +0900 Subject: [PATCH] Fix #294 --- lua/cmp/source.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/cmp/source.lua b/lua/cmp/source.lua index 4f55fda..274b255 100644 --- a/lua/cmp/source.lua +++ b/lua/cmp/source.lua @@ -107,8 +107,13 @@ source.get_entries = function(self, ctx) local score, matches = matcher.match(inputs[o], e:get_filter_text(), { e:get_word() }) e.score = score e.exact = false - e.matches = matches if e.score >= 1 then + if e:get_filter_text() ~= e.completion_item.label then + local _, matches_for_highlights = matcher.match(inputs[o], e.completion_item.label, {}) + e.matches = matches_for_highlights + else + e.matches = matches + end e.exact = e:get_filter_text() == inputs[o] or e:get_word() == inputs[o] table.insert(entries, e) end