Neovim/lua/plugins/lsp.lua

56 lines
1.7 KiB
Lua

return {
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim"
},
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,
},
},
},
},
config = function(_, opts)
local options = require("options")
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 {}
end,
}
require("mason-lspconfig").setup({ handlers = handlers })
-- 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
}
}