my-nvim-setup/lua/plugins/lsp.lua

104 lines
2.8 KiB
Lua
Raw Normal View History

2024-02-15 11:13:37 +00:00
return {
2024-03-05 06:54:50 +00:00
{
"williamboman/mason.nvim",
config = function()
require("mason").setup {
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
border = "rounded",
},
}
end,
},
2024-02-15 11:13:37 +00:00
2024-03-05 06:54:50 +00:00
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup()
require("mason-lspconfig").setup_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,
2024-02-15 11:13:37 +00:00
2024-03-05 06:54:50 +00:00
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
}
end,
},
2024-02-15 11:13:37 +00:00
2024-03-05 06:54:50 +00:00
{
"neovim/nvim-lspconfig",
config = function()
require "plugins/lspconfig/config"()
end,
},
2024-02-15 11:13:37 +00:00
2024-03-05 06:54:50 +00:00
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local null_ls = require "null-ls"
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
2024-02-15 11:13:37 +00:00
2024-03-05 06:54:50 +00:00
null_ls.setup {
border = "rounded",
cmd = { "nvim" },
debounce = 250,
debug = false,
default_timeout = 5000,
diagnostic_config = {},
diagnostics_format = "#{m}",
fallback_severity = vim.diagnostic.severity.ERROR,
log_level = "warn",
notify_format = "[null-ls] %s",
on_init = nil,
on_exit = nil,
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git"),
should_attach = nil,
sources = nil,
temp_dir = nil,
update_in_insert = false,
-- formatting on save
2024-03-05 06:56:29 +00:00
on_attach = function(client, bufnr)
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { bufnr = bufnr }
end,
})
end
end,
}
2024-03-05 06:54:50 +00:00
end,
},
{
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
config = function()
require("mason-null-ls").setup {
automatic_setup = true,
ensure_installed = { "shfmt", "prettier", "stylua" },
handlers = {},
}
end,
},
2024-02-15 11:13:37 +00:00
}