106 lines
2.8 KiB
Lua
106 lines
2.8 KiB
Lua
return {
|
|
-- lspconfig
|
|
{
|
|
"mason-org/mason-lspconfig.nvim",
|
|
enabled = true,
|
|
dependencies = {
|
|
{
|
|
"mason-org/mason.nvim",
|
|
opts = {},
|
|
},
|
|
"neovim/nvim-lspconfig",
|
|
},
|
|
opts = {
|
|
automatic_enable = true,
|
|
ensure_installed = {
|
|
"lua_ls",
|
|
"gopls"
|
|
},
|
|
},
|
|
config = function(_, opts)
|
|
-- get all the servers that are available thourgh mason-lspconfig
|
|
local all_mslp_servers = vim.tbl_keys(require("mason-lspconfig").get_mappings().lspconfig_to_package)
|
|
|
|
-- parse custom configs from lsp.config and add to ensure intsalled
|
|
local ensure_installed = {} ---@type string[]
|
|
for server, server_opts in pairs(require("lazyvim.plugins.lsp.config").opts.servers) do
|
|
if server_opts then
|
|
server_opts = server_opts == true and {} or server_opts
|
|
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
|
if server_opts.mason == true or vim.tbl_contains(all_mslp_servers, server) then
|
|
ensure_installed[#ensure_installed + 1] = server
|
|
end
|
|
end
|
|
end
|
|
|
|
-- merge ensure installed
|
|
opts.ensure_installed = vim.tbl_deep_extend("force",
|
|
{},
|
|
opts.ensure_installed or {},
|
|
ensure_installed)
|
|
|
|
require("mason-lspconfig").setup(opts)
|
|
require("lazyvim.plugins.lsp.config").setup()
|
|
end,
|
|
},
|
|
|
|
{
|
|
"mason-org/mason.nvim",
|
|
cmd = "Mason",
|
|
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
|
opts = {
|
|
automatic_istallation = false,
|
|
},
|
|
},
|
|
|
|
-- formatting
|
|
{
|
|
"stevearc/conform.nvim",
|
|
enabled = true,
|
|
opts = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
-- Conform will run multiple formatters sequentially
|
|
python = { "isort", "black" },
|
|
-- Use a sub-list to run only the first available formatter
|
|
typescript = { { "prettierd", "prettier" } },
|
|
cs = { "csharpier" },
|
|
},
|
|
formatters = {
|
|
csharpier = {
|
|
command = "dotnet-csharpier",
|
|
args = { "--write-stdout" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
-- cmdline tools and lsp servers
|
|
{
|
|
"mason-org/mason.nvim",
|
|
enabled = true,
|
|
cmd = "Mason",
|
|
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
|
opts = {
|
|
automatic_istallation = false,
|
|
},
|
|
},
|
|
|
|
-- language specific tooling
|
|
{
|
|
"simrat39/rust-tools.nvim",
|
|
enabled = false,
|
|
opts = {
|
|
server = {
|
|
on_attach = function(_, bufnr)
|
|
local rt = require("rust-tools")
|
|
-- Hover actions
|
|
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
|
-- Code action groups
|
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
}
|