feat: add language server configuration

This commit is contained in:
Sven Vogel 2024-11-08 17:16:27 +01:00
parent 6b5508c3a3
commit e602c90efc
1 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,80 @@
--
-- Start config for builtin Neovim language server protocol client
--
-- Source: https://github.com/RRethy/vim-illuminate
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 08.11.2024
-- Edited: 08.11.2024
--
-- ==============================================
ui = require 'config.ui'
return {
{
'neovim/nvim-lspconfig',
dependencies = {
"williamboman/mason.nvim",
{
"williamboman/mason-lspconfig.nvim",
config = function()
end
},
},
opts = {
inlay_hints = {
enabled = true,
},
diagnostics = {
virtual_text = true,
signs = true,
update_in_insert = false,
underline = true,
severity_sort = false,
float = {
border = ui.border,
source = 'always',
},
}
},
config = function(opts)
require("mason").setup()
local handlers = {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({
on_attach = function(client, bufnr)
end
})
end,
}
require("mason-lspconfig").setup({ handlers = handlers })
-- Setup diagnostic user interface
--
-- Source: https://vonheikemen.github.io/devlog/tools/setup-nvim-lspconfig-plus-nvim-cmp
-- ..............................................
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{
border = ui.border
})
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{
border = ui.border
})
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
end
}
}