SoloVim/lua/user/mason/mason-installer.lua
Kristofers Solo 1d2ec9ea62 Added cmake
2023-02-27 13:34:22 +02:00

79 lines
1.7 KiB
Lua

local status_ok, mason = pcall(require, "mason")
if not status_ok then
return
end
local status_lspconfig_ok, lspconfig = pcall(require, "lspconfig")
if not status_lspconfig_ok then
return
end
local status_mason_lspconfig_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
if not status_mason_lspconfig_ok then
return
end
local servers = {
"bashls",
"cssls",
"clangd",
"cmake",
"emmet_ls",
"html",
"jsonls",
"jedi_language_server",
"rust_analyzer",
"lua_ls",
"taplo",
"texlab",
"tsserver",
"yamlls",
}
mason.setup()
mason_lspconfig.setup({
ensure_installed = servers,
})
local on_attach = require("user.mason.handlers").on_attach
local capabilities = require("user.mason.handlers").capabilities
for _, server in pairs(servers) do
local opts = {
capabilities = capabilities,
on_attach = on_attach,
}
if server == "bashls" then
local bashls_opts = require("user.mason.settings.bashls")
opts = vim.tbl_deep_extend("force", bashls_opts, opts)
end
if server == "lua_ls" then
local lua_ls_opts = require("user.mason.settings.lua_ls")
opts = vim.tbl_deep_extend("force", lua_ls_opts, opts)
end
if server == "emmet_ls" then
local emmet_ls_opts = require("user.mason.settings.emmet_ls")
opts = vim.tbl_deep_extend("force", emmet_ls_opts, opts)
end
if server == "rust_analyzer" then
local rust_analyzer_opts = require("user.mason.settings.rust_analyzer")
opts = vim.tbl_deep_extend("force", rust_analyzer_opts, opts)
require("rust-tools").setup(opts)
goto continue
end
if server == "clangd" then
local clangd_opts = require("user.mason.settings.clangd")
opts = vim.tbl_deep_extend("force", clangd_opts, opts)
require("clangd_extensions").setup(opts)
goto continue
end
lspconfig[server].setup(opts)
::continue::
end