Neovim/lua/plugins/lsp.lua

62 lines
2.2 KiB
Lua
Raw Normal View History

2024-02-23 18:23:02 +00:00
return {
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
2024-02-23 18:23:02 +00:00
},
opts = {
diagnostics = {
underline = true,
update_in_insert = true,
virtual_text = {
spacing = 4,
source = "if_many",
prefix = "",
},
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = require("options").lsp.icons.Error,
[vim.diagnostic.severity.WARN] = require("options").lsp.icons.Warn,
[vim.diagnostic.severity.HINT] = require("options").lsp.icons.Hint,
[vim.diagnostic.severity.INFO] = require("options").lsp.icons.Info,
},
},
},
2024-02-23 18:23:02 +00:00
},
config = function(_, opts)
local options = require("options")
require("mason").setup()
2024-02-25 17:12:48 +00:00
local handlers = {
2024-02-23 18:23:02 +00:00
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
2024-02-23 18:23:02 +00:00
-- a dedicated handler.
function(server_name) -- default handler (optional)
2024-04-13 15:00:38 +00:00
require("lspconfig")[server_name].setup({
on_attach = function(client, bufnr)
if client.server_capabilities["documentSymbolProvider"] then
require("nvim-navic").attach(client, bufnr)
end
end,
})
2024-02-23 18:23:02 +00:00
end,
}
2024-02-25 17:12:48 +00:00
require("mason-lspconfig").setup({ handlers = handlers })
2024-02-23 18:23:02 +00:00
-- set custom icons
for name, icon in pairs(options.lsp.icons) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
require("lspconfig").gdscript.setup({})
end,
},
2024-02-23 18:23:02 +00:00
}