diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..7080c3e --- /dev/null +++ b/lua/plugins/nvim-lspconfig.lua @@ -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 + } +}