nvim/lua/lsp/installer.lua

52 lines
1.2 KiB
Lua
Raw Normal View History

2023-02-26 21:07:32 +00:00
local status1, mason = pcall(require, "mason")
local status2, mason_lspconfig = pcall(require, "mason-lspconfig")
if (not (status1 and status2)) then return end
2023-01-23 13:47:01 +00:00
2023-02-26 21:07:32 +00:00
return function(on_attach)
mason.setup {}
mason_lspconfig.setup {
ensure_installed = { 'jdtls', 'lua_ls' }
}
2023-01-23 13:47:01 +00:00
2023-02-26 21:07:32 +00:00
local no_autosetup = {
jdtls = true
}
local extra_config = {
lua_ls = {
on_attach = on_attach,
settings = {
Lua = {
diagnostics = { globals = { 'vim' } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
2023-03-31 10:16:59 +00:00
checkThirdParty = false,
2023-02-26 21:07:32 +00:00
},
telemetry = { enable = false },
},
},
2023-03-22 13:35:50 +00:00
},
["pylsp"] = {
on_attach = on_attach,
settings = {
pylsp = {
plugins = {
rope_autoimport = { enabled = true, },
isort = { enabled = true, },
}
}
}
2023-02-26 21:07:32 +00:00
}
}
mason_lspconfig.setup_handlers {
function(server_name)
if (not no_autosetup[server_name]) then
require("lspconfig")[server_name].setup(
extra_config[server_name] or { on_attach = on_attach }
)
end
end,
}
end