2024-02-23 18:23:02 +00:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
dependencies = {
|
|
|
|
"williamboman/mason.nvim",
|
2024-04-13 08:49:11 +00:00
|
|
|
"williamboman/mason-lspconfig.nvim",
|
2024-02-23 18:23:02 +00:00
|
|
|
},
|
2024-05-16 22:30:15 +00:00
|
|
|
priority = 500,
|
2024-02-23 18:23:02 +00:00
|
|
|
opts = {
|
|
|
|
diagnostics = {
|
2024-04-13 08:49:11 +00:00
|
|
|
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-05-16 22:30:15 +00:00
|
|
|
local coq = require('coq')
|
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
|
2024-04-13 08:49:11 +00:00
|
|
|
-- and will be called for each installed server that doesn't have
|
2024-02-23 18:23:02 +00:00
|
|
|
-- a dedicated handler.
|
2024-04-13 08:49:11 +00:00
|
|
|
function(server_name) -- default handler (optional)
|
2024-05-16 22:30:15 +00:00
|
|
|
require("lspconfig")[server_name].setup(coq.lsp_ensure_capabilities({
|
2024-04-13 15:00:38 +00:00
|
|
|
on_attach = function(client, bufnr)
|
2024-05-16 22:30:15 +00:00
|
|
|
-- setup lsp-format
|
|
|
|
require("lsp-format").on_attach(client, bufnr)
|
|
|
|
-- setup navic
|
2024-04-13 15:00:38 +00:00
|
|
|
if client.server_capabilities["documentSymbolProvider"] then
|
|
|
|
require("nvim-navic").attach(client, bufnr)
|
|
|
|
end
|
2024-05-16 22:30:15 +00:00
|
|
|
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))
|
2024-04-13 08:49:11 +00:00
|
|
|
|
|
|
|
require("lspconfig").gdscript.setup({})
|
|
|
|
end,
|
|
|
|
},
|
2024-05-16 22:30:15 +00:00
|
|
|
{
|
|
|
|
'lukas-reineke/lsp-format.nvim',
|
|
|
|
}
|
2024-02-23 18:23:02 +00:00
|
|
|
}
|