allow system bash-language-server
This commit is contained in:
1 parent
800d60a312
commit
67539072a5
3 files changed
+30
-4
No files matched your search
@@ -29,6 +29,8 @@ NV_DARCULA_COLOR_SCHEME =
|
|||||||
NV_DARCULA_TERMGUI_COLORS =
|
NV_DARCULA_TERMGUI_COLORS =
|
||||||
utils.parse_env("NV_DARCULA_TERMGUI_COLORS", utils.detect_termguicolors())
|
utils.parse_env("NV_DARCULA_TERMGUI_COLORS", utils.detect_termguicolors())
|
||||||
NV_DARCULA_ENABLE_COC = utils.parse_env("NV_DARCULA_ENABLE_COC", true)
|
NV_DARCULA_ENABLE_COC = utils.parse_env("NV_DARCULA_ENABLE_COC", true)
|
||||||
|
NV_DARCULA_USE_SYSTEM_BASH_LS =
|
||||||
|
utils.parse_env("NV_DARCULA_USE_SYSTEM_BASH_LS", false)
|
||||||
NV_DARCULA_ENABLE_CODE_LENS =
|
NV_DARCULA_ENABLE_CODE_LENS =
|
||||||
utils.parse_env("NV_DARCULA_ENABLE_CODE_LENS", false)
|
utils.parse_env("NV_DARCULA_ENABLE_CODE_LENS", false)
|
||||||
NV_DARCULA_ENABLE_DAP = utils.parse_env("NV_DARCULA_ENABLE_DAP", true)
|
NV_DARCULA_ENABLE_DAP = utils.parse_env("NV_DARCULA_ENABLE_DAP", true)
|
||||||
@@ -165,7 +167,6 @@ NV_DARCULA_MASON_INST_LIST =
|
|||||||
utils.parse_env_list(
|
utils.parse_env_list(
|
||||||
"NV_DARCULA_MASON_INST_LIST",
|
"NV_DARCULA_MASON_INST_LIST",
|
||||||
{
|
{
|
||||||
"bashls",
|
|
||||||
"clangd",
|
"clangd",
|
||||||
"cmake",
|
"cmake",
|
||||||
"cspell_ls",
|
"cspell_ls",
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ require("mason").setup {
|
|||||||
local ensure_installed = vim.deepcopy(NV_DARCULA_MASON_INST_LIST)
|
local ensure_installed = vim.deepcopy(NV_DARCULA_MASON_INST_LIST)
|
||||||
vim.list_extend(ensure_installed, NV_DARCULA_MASON_TOOL_LIST)
|
vim.list_extend(ensure_installed, NV_DARCULA_MASON_TOOL_LIST)
|
||||||
|
|
||||||
|
-- When not using the system-installed bash-language-server, let mason install
|
||||||
|
-- and manage bashls like any other server.
|
||||||
|
if not NV_DARCULA_USE_SYSTEM_BASH_LS then
|
||||||
|
table.insert(ensure_installed, "bashls")
|
||||||
|
end
|
||||||
|
|
||||||
local installer = require("mason-tool-installer")
|
local installer = require("mason-tool-installer")
|
||||||
installer.setup {
|
installer.setup {
|
||||||
ensure_installed = ensure_installed,
|
ensure_installed = ensure_installed,
|
||||||
|
|||||||
@@ -24,10 +24,25 @@ end
|
|||||||
---@diagnostic disable-next-line: deprecated
|
---@diagnostic disable-next-line: deprecated
|
||||||
local unpacker = table.unpack or unpack
|
local unpacker = table.unpack or unpack
|
||||||
|
|
||||||
|
-- Servers whose binaries are installed on the system (not managed by mason).
|
||||||
|
-- mason-lspconfig's automatic_enable only enables servers whose mason package
|
||||||
|
-- is installed, so these must be excluded there and enabled explicitly below.
|
||||||
|
local system_installed = {"vala_ls"}
|
||||||
|
|
||||||
|
-- When using the system-installed bash-language-server (Dockerfile.extra),
|
||||||
|
-- bashls must be enabled explicitly rather than via mason.
|
||||||
|
if NV_DARCULA_USE_SYSTEM_BASH_LS then
|
||||||
|
table.insert(system_installed, "bashls")
|
||||||
|
end
|
||||||
|
|
||||||
-- Exclude servers that are not managed by mason (e.g., system-installed)
|
-- Exclude servers that are not managed by mason (e.g., system-installed)
|
||||||
local mason_lsp_auto_enable = vim.tbl_filter(function(name)
|
local mason_lsp_auto_enable =
|
||||||
return not vim.tbl_contains({"vala_ls"}, name)
|
vim.tbl_filter(
|
||||||
end, NV_DARCULA_MASON_LSP_LIST)
|
function(name)
|
||||||
|
return not vim.tbl_contains(system_installed, name)
|
||||||
|
end,
|
||||||
|
NV_DARCULA_MASON_LSP_LIST
|
||||||
|
)
|
||||||
|
|
||||||
require("mason-lspconfig").setup {
|
require("mason-lspconfig").setup {
|
||||||
automatic_enable = mason_lsp_auto_enable
|
automatic_enable = mason_lsp_auto_enable
|
||||||
@@ -148,6 +163,10 @@ for _, name in pairs(NV_DARCULA_MASON_LSP_LIST) do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
elseif name == "bashls" and NV_DARCULA_USE_SYSTEM_BASH_LS then
|
||||||
|
-- system-installed (Dockerfile.extra); mason does not manage it
|
||||||
|
vim.lsp.config(name, {})
|
||||||
|
vim.lsp.enable(name)
|
||||||
elseif name == "vala_ls" then
|
elseif name == "vala_ls" then
|
||||||
vim.lsp.config(name, {})
|
vim.lsp.config(name, {})
|
||||||
vim.lsp.enable(name)
|
vim.lsp.enable(name)
|
||||||
|
|||||||
Reference in new issue
Block a user