Squashed 'users/daniel/configs/system/nvim/nvim/' content from commit f10b473
git-subtree-dir: users/daniel/configs/system/nvim/nvim git-subtree-split: f10b4730176b567e15911b3c1a7c5a31c82c8b8e
This commit is contained in:
41
lua/plugins/configs/lspconfig.lua
Normal file
41
lua/plugins/configs/lspconfig.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
return function(_, _)
|
||||
local lsp = require "astronvim.utils.lsp"
|
||||
local get_icon = require("astronvim.utils").get_icon
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = get_icon "DiagnosticError", texthl = "DiagnosticSignError" },
|
||||
{ name = "DiagnosticSignWarn", text = get_icon "DiagnosticWarn", texthl = "DiagnosticSignWarn" },
|
||||
{ name = "DiagnosticSignHint", text = get_icon "DiagnosticHint", texthl = "DiagnosticSignHint" },
|
||||
{ name = "DiagnosticSignInfo", text = get_icon "DiagnosticInfo", texthl = "DiagnosticSignInfo" },
|
||||
{ name = "DapStopped", text = get_icon "DapStopped", texthl = "DiagnosticWarn" },
|
||||
{ name = "DapBreakpoint", text = get_icon "DapBreakpoint", texthl = "DiagnosticInfo" },
|
||||
{ name = "DapBreakpointRejected", text = get_icon "DapBreakpointRejected", texthl = "DiagnosticError" },
|
||||
{ name = "DapBreakpointCondition", text = get_icon "DapBreakpointCondition", texthl = "DiagnosticInfo" },
|
||||
{ name = "DapLogPoint", text = get_icon "DapLogPoint", texthl = "DiagnosticInfo" },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, sign)
|
||||
end
|
||||
lsp.setup_diagnostics(signs)
|
||||
|
||||
if vim.g.lsp_handlers_enabled then
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", silent = true })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", silent = true })
|
||||
end
|
||||
local setup_servers = function()
|
||||
vim.tbl_map(require("astronvim.utils.lsp").setup, astronvim.user_opts "lsp.servers")
|
||||
vim.api.nvim_exec_autocmds("FileType", {})
|
||||
require("astronvim.utils").event "LspSetup"
|
||||
end
|
||||
if require("astronvim.utils").is_available "mason-lspconfig.nvim" then
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
desc = "set up LSP servers after mason-lspconfig",
|
||||
pattern = "AstroMasonLspSetup",
|
||||
once = true,
|
||||
callback = setup_servers,
|
||||
})
|
||||
else
|
||||
setup_servers()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user