Make enhancement for Astra
This commit is contained in:
parent
21403a7774
commit
d2239e1e96
1 changed files with 16 additions and 14 deletions
|
@ -84,16 +84,29 @@ end, vim.tbl_keys(servers))
|
|||
|
||||
require("mason").setup()
|
||||
local ensure_installed = {
|
||||
-- Normal settings
|
||||
"stylua",
|
||||
"lua_ls",
|
||||
"ruff",
|
||||
"gopls",
|
||||
"gofumpt",
|
||||
"golines",
|
||||
"prettier",
|
||||
"pyright"
|
||||
}
|
||||
|
||||
-- Now we need to make things work in Astra
|
||||
-- Main Astra cockblock - low python version, that prevents installation of
|
||||
-- some modules, so in order to prevent mason from whining - disable some
|
||||
-- autoinstall modules depending on currently installed python version
|
||||
-- NOTE: You must install removed dependencies manually
|
||||
local python_version = io.popen("python --version"):read("*a")
|
||||
local _, minor, _ = python_version:match("Python (%d+)%.(%d+)%.(%d+)")
|
||||
if tonumber(minor) < 8 then
|
||||
for i, k in pairs(servers_to_install) do
|
||||
-- Ruff is not supported for python lower than 3.8
|
||||
if k == "ruff" then
|
||||
table.remove(servers_to_install, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.list_extend(ensure_installed, servers_to_install)
|
||||
require("mason-tool-installer").setup { ensure_installed = ensure_installed }
|
||||
|
||||
|
@ -108,17 +121,6 @@ for name, config in pairs(servers) do
|
|||
lspconfig[name].setup(config)
|
||||
end
|
||||
|
||||
for name, config in pairs(servers) do
|
||||
if config == true then
|
||||
config = {}
|
||||
end
|
||||
config = vim.tbl_deep_extend("force", {}, {
|
||||
capabilities = capabilities,
|
||||
}, config)
|
||||
|
||||
lspconfig[name].setup(config)
|
||||
end
|
||||
|
||||
-- Here it is used the LSP server attaches to file
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- Grouping together autocommands.
|
||||
|
|
Loading…
Reference in a new issue