nvim-config11/lua/plugins/lsp.lua

78 lines
2.7 KiB
Lua
Raw Normal View History

2025-03-27 08:18:20 +00:00
vim.diagnostic.config({
2025-08-06 17:12:25 +01:00
virtual_lines = false,
virtual_text = false,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "󰅙",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "󰌵",
[vim.diagnostic.severity.INFO] = "",
},
},
2025-03-27 08:18:20 +00:00
})
return {
2025-03-31 11:19:48 +01:00
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require('lspconfig')
2025-04-04 14:59:29 +01:00
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
2025-03-31 11:19:48 +01:00
for _, v in ipairs(vim.api.nvim_get_runtime_file('lua/lsp/*', true)) do
local name = vim.fn.fnamemodify(v, ':t:r')
local cfg = require("lsp/" .. name)
2025-07-16 19:16:58 +00:00
if lspconfig[name].setup ~= nil then
lspconfig[name].setup(vim.tbl_deep_extend("force", cfg, { capabilities }))
else
vim.notify("LSP server " .. name .. " does not have a setup function", vim.log.levels.ERROR)
end
2025-03-31 11:19:48 +01:00
end
end
},
2025-03-27 08:18:20 +00:00
{
"williamboman/mason.nvim",
2025-03-27 08:18:20 +00:00
opts = {
tools_to_install = {
"lua-language-server", "vtsls", "ruff", "mypy", "black",
2025-07-16 20:14:33 +01:00
"pyright", "emmet-language-server", "tailwindcss-language-server",
2025-03-27 12:48:32 +00:00
"eslint-lsp", "lemminx", "gopls", "prettierd", "dotenv-linter",
2025-07-16 19:16:58 +00:00
"editorconfig-checker", "rust-analyzer", "taplo", "kulala-fmt",
2025-08-20 01:54:27 +01:00
"json-lsp", "harper-ls", "proselint", "alex", "yaml-language-server",
"golangci-lint-langserver", "golangci-lint"
2025-03-27 08:18:20 +00:00
}
},
config = function(_, opts)
require("mason").setup()
local mason_registry = require("mason-registry")
mason_registry.refresh()
for _, tool in pairs(opts.tools_to_install) do
local package = mason_registry.get_package(tool)
if not package:is_installed() then
package:install()
end
end
end
},
{
"nvimtools/none-ls.nvim",
dependencies = { "nvimtools/none-ls-extras.nvim" },
config = function()
2025-03-27 08:18:20 +00:00
local null_ls = require("null-ls")
2025-07-16 19:16:58 +00:00
2025-03-27 08:18:20 +00:00
null_ls.setup({
sources = {
2025-03-27 12:48:32 +00:00
null_ls.builtins.diagnostics.dotenv_linter,
null_ls.builtins.diagnostics.editorconfig_checker,
2025-04-01 18:05:47 +01:00
null_ls.builtins.diagnostics.proselint,
null_ls.builtins.diagnostics.alex
2025-03-27 08:18:20 +00:00
},
})
end
}
}