vim/lsp: override handlers via lspconfig rather than globally

This commit is contained in:
Fernando Schauenburg 2023-08-22 09:55:42 +02:00
parent 51be43ec10
commit 7b4e7462b7

View file

@ -15,19 +15,17 @@ M.config = function()
local border = { border = 'rounded' } local border = { border = 'rounded' }
for request, handler in pairs {
['textDocument/hover'] = vim.lsp.handlers.hover,
['textDocument/signatureHelp'] = vim.lsp.handlers.signature_help,
} do
vim.lsp.handlers[request] = vim.lsp.with(handler, border)
end
local opts = { local opts = {
capabilities = extend( capabilities = extend(
vim.lsp.protocol.make_client_capabilities(), vim.lsp.protocol.make_client_capabilities(),
vim.F.npcall(function() require('cmp_nvim_lsp').default_capabilities() end) vim.F.npcall(function() require('cmp_nvim_lsp').default_capabilities() end)
), ),
handlers = {
['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, border),
['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, border),
},
on_attach = function(--[[client]]_, bufnr) on_attach = function(--[[client]]_, bufnr)
vim.bo.omnifunc = 'v:lua.vim.lsp.omnifunc' -- do completion with <c-x><c-o> vim.bo.omnifunc = 'v:lua.vim.lsp.omnifunc' -- do completion with <c-x><c-o>
local map, opts = vim.keymap.set, { buffer = bufnr } local map, opts = vim.keymap.set, { buffer = bufnr }