From 4d87744117b6544249b829976498efa74e3baade Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Thu, 4 Jan 2024 17:35:05 -0500 Subject: [PATCH] Stop suggesting random text as a snippet. https://stackoverflow.com/questions/73092651/neovim-how-to-filter-out-text-snippets-from-nvim-lspconfig-nvim-cmp#comment129185571_73144320 lead me to https://github.com/hrsh7th/nvim-cmp/pull/1067 which fixed the wonky mess that was happening. --- .../home-manager/files/nvim/lua/plugins/completions.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/home-manager/files/nvim/lua/plugins/completions.lua b/modules/home-manager/files/nvim/lua/plugins/completions.lua index 1804f52..0318318 100644 --- a/modules/home-manager/files/nvim/lua/plugins/completions.lua +++ b/modules/home-manager/files/nvim/lua/plugins/completions.lua @@ -23,8 +23,13 @@ return { [""] = cmp.mapping.confirm({ select = true }), }), sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, -- For luasnip users. + { + name = "nvim_lsp", + entry_filter = function(entry) + return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= "Text" + end, + }, + { name = "luasnip" }, }, { { name = "buffer" }, }),