Remove snippets and buffer completion from nvim cmp, Copilot does a great job of this, now we only have completions for defined variables, functions, and keywords etc

This commit is contained in:
Martin Larsson 2024-05-23 11:00:28 +02:00
parent 14aaeece77
commit ec81bcfa73
2 changed files with 9 additions and 10 deletions

View file

@ -7,15 +7,10 @@ return {
"hrsh7th/cmp-cmdline",
},
config = function()
-- Set up nvim-cmp.
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
@ -26,11 +21,14 @@ return {
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
},
sources = cmp.config.sources(
{
{ name = "buffer" },
{
name = "nvim_lsp",
entry_filter = function(entry)
return cmp.lsp.CompletionItemKind.Snippet ~= entry:get_kind()
end,
},
})
})

View file

@ -7,6 +7,7 @@ local function setup_lsp(server_names)
local server = lspconfig[server_name]
if server then
local server_table = require("language_servers/" .. server_name)
capabilities.textDocument.completion.completionItem.snippetSupport = false
server_table.capabilities = capabilities
server_table.on_attach = function(client, bufnr)
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })