From b9edce72147af5fbd8e6b9cf5b6c2da5169beea6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 28 Dec 2021 20:17:22 +0200 Subject: [PATCH] Add the snippet indicator for items with Snippet kind (#677) --- lua/cmp/entry.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/cmp/entry.lua b/lua/cmp/entry.lua index e1a07c5..fd52e2f 100644 --- a/lua/cmp/entry.lua +++ b/lua/cmp/entry.lua @@ -240,13 +240,16 @@ entry.get_vim_item = function(self, suggest_offset) local abbr = str.oneline(completion_item.label) -- ~ indicator + local is_snippet = false if #(misc.safe(completion_item.additionalTextEdits) or {}) > 0 then - abbr = abbr .. '~' + is_snippet = true elseif completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then - local insert_text = self:get_insert_text() - if word ~= insert_text then - abbr = abbr .. '~' - end + is_snippet = self:get_insert_text() ~= word + elseif completion_item.kind == types.lsp.CompletionItemKind.Snippet then + is_snippet = true + end + if is_snippet then + abbr = abbr .. '~' end -- append delta text