From dd6e4d96f9e376c87302fa5414556aa6269bf997 Mon Sep 17 00:00:00 2001 From: Eric <197371+ZwodahS@users.noreply.github.com> Date: Mon, 28 Mar 2022 17:22:45 +0800 Subject: [PATCH] use only the first filetype when formatting (#857) --- lua/cmp/entry.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/cmp/entry.lua b/lua/cmp/entry.lua index 8574b92..5d82d19 100644 --- a/lua/cmp/entry.lua +++ b/lua/cmp/entry.lua @@ -411,9 +411,14 @@ entry.get_documentation = function(self) -- detail if misc.safe(item.detail) and item.detail ~= '' then + local ft = self.context.filetype + local dot_index = string.find(ft, "%.") + if dot_index ~= nil then + ft = string.sub(ft, 0, dot_index-1) + end table.insert(documents, { kind = types.lsp.MarkupKind.Markdown, - value = ('```%s\n%s\n```'):format(self.context.filetype, str.trim(item.detail)), + value = ('```%s\n%s\n```'):format(ft, str.trim(item.detail)), }) end