From 344ba497eb226a2a45776418925a1c1cc2c807a9 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 3 Sep 2024 16:48:56 -0400 Subject: [PATCH] filter out snippets from completion suggestions --- lua/plugins/lsp.lua | 1 + lua/plugins/nvim-cmp.lua | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 4dce6ac..cfa0e2f 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -156,6 +156,7 @@ return { -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + -- capabilities.textDocument.completion.completionItem.snippetSupport = false -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index f9d965c..4398a01 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -107,7 +107,13 @@ return { -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it group_index = 0, }, - { name = 'nvim_lsp' }, + { + name = 'nvim_lsp', + entry_filter = function(entry, ctx) + -- do not show snippets in the completion list + return require('cmp').lsp.CompletionItemKind.Snippet ~= entry:get_kind() + end, + }, { name = 'luasnip' }, { name = 'path' }, },