neovim: Fix compatibility with newer plugin versions

This commit is contained in:
Simon Bruder 2022-05-31 14:40:18 +02:00
parent f4d2bdfb4a
commit 12be176ecc
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -147,7 +147,7 @@ cmp.setup {
snippet = { snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end, expand = function(args) luasnip.lsp_expand(args.body) end,
}, },
mapping = { mapping = cmp.mapping.preset.insert({
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), ['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-e>'] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), ['<C-e>'] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
@ -174,7 +174,7 @@ cmp.setup {
fallback() fallback()
end end
end, { 'i', 's' }), end, { 'i', 's' }),
}, }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
@ -182,7 +182,7 @@ cmp.setup {
}, { }, {
{ {
name = 'buffer', name = 'buffer',
opts = { option = {
keyword_pattern = [[\k\+]], -- allow unicode multibyte characters keyword_pattern = [[\k\+]], -- allow unicode multibyte characters
}, },
} }
@ -202,9 +202,8 @@ vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagn
update_in_insert = true, -- update suggestions in insert mode update_in_insert = true, -- update suggestions in insert mode
}) })
for type, icon in pairs({ Error = '', Warning = '', Hint = '', Information = '' }) do for type, icon in pairs({ Error = '', Warn = '', Hint = '', Info = '' }) do
local hl = 'LspDiagnosticsSign' .. type fn.sign_define("DiagnosticSign" .. type, { text = icon, texthl = "Diagnostic" .. type })
fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end end
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)