use mason for dependency management
This commit is contained in:
@@ -83,6 +83,14 @@ function check_binary() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensure_brew_binary() {
|
||||||
|
if ! command -v "$1" >/dev/null 2>&1; then
|
||||||
|
check_binary brew
|
||||||
|
brew install "$2"
|
||||||
|
fi
|
||||||
|
check_binary "$1"
|
||||||
|
}
|
||||||
|
|
||||||
export PATH="${HOME}/.local/bin:${PATH}"
|
export PATH="${HOME}/.local/bin:${PATH}"
|
||||||
|
|
||||||
for BINARY in "${NVIM_REQUIRED_BINARIES[@]}"; do
|
for BINARY in "${NVIM_REQUIRED_BINARIES[@]}"; do
|
||||||
@@ -94,13 +102,9 @@ if ! command -v luafmt >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
check_binary luafmt
|
check_binary luafmt
|
||||||
|
|
||||||
if [ "${NVIM_OS}" = "macOS" ] &&
|
|
||||||
! command -v vala-language-server >/dev/null 2>&1; then
|
|
||||||
check_binary brew
|
|
||||||
brew install vala-language-server
|
|
||||||
fi
|
|
||||||
if [ "${NVIM_OS}" = "macOS" ]; then
|
if [ "${NVIM_OS}" = "macOS" ]; then
|
||||||
check_binary vala-language-server
|
ensure_brew_binary pwsh powershell
|
||||||
|
ensure_brew_binary vala-language-server vala-language-server
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd "${SCRIPT_DIR}" 1>/dev/null 2>&1 || error_exit "failed to push: ${SCRIPT_DIR}"
|
pushd "${SCRIPT_DIR}" 1>/dev/null 2>&1 || error_exit "failed to push: ${SCRIPT_DIR}"
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ NV_DARCULA_ENABLE_INLAY_HINTS =
|
|||||||
utils.parse_env("NV_DARCULA_ENABLE_INLAY_HINTS", false)
|
utils.parse_env("NV_DARCULA_ENABLE_INLAY_HINTS", false)
|
||||||
NV_DARCULA_ENABLE_VIRTUAL_TEXT =
|
NV_DARCULA_ENABLE_VIRTUAL_TEXT =
|
||||||
utils.parse_env("NV_DARCULA_ENABLE_VIRTUAL_TEXT", false)
|
utils.parse_env("NV_DARCULA_ENABLE_VIRTUAL_TEXT", false)
|
||||||
|
NV_DARCULA_MASON_ROOT =
|
||||||
|
utils.parse_env(
|
||||||
|
"NV_DARCULA_MASON_ROOT",
|
||||||
|
vim.fs.normalize(
|
||||||
|
vim.fs.joinpath(vim.fn.stdpath("data"), "..", "darcula", "mason")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
NV_DARCULA_CLANGD_ARGS =
|
NV_DARCULA_CLANGD_ARGS =
|
||||||
utils.parse_env_list(
|
utils.parse_env_list(
|
||||||
|
|||||||
@@ -719,10 +719,8 @@ if not NV_DARCULA_ENABLE_COC then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not NV_DARCULA_ENABLE_COC then
|
function M.mason()
|
||||||
function M.mason()
|
km.map(km.leader "in", ":Mason<CR>", {remap = true, silent = true})
|
||||||
km.map(km.leader "in", ":Mason<CR>", {remap = true, silent = true})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.navigation()
|
function M.navigation()
|
||||||
@@ -1453,9 +1451,7 @@ end
|
|||||||
if not NV_DARCULA_ENABLE_COC then
|
if not NV_DARCULA_ENABLE_COC then
|
||||||
M.lsp()
|
M.lsp()
|
||||||
end
|
end
|
||||||
if not NV_DARCULA_ENABLE_COC then
|
M.mason()
|
||||||
M.mason()
|
|
||||||
end
|
|
||||||
M.navigation()
|
M.navigation()
|
||||||
M.nvim_dap()
|
M.nvim_dap()
|
||||||
M.nvim_haven()
|
M.nvim_haven()
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ vim.api.nvim_create_autocmd(
|
|||||||
local packages = {
|
local packages = {
|
||||||
{src = "https://github.com/nvim-lua/plenary.nvim"},
|
{src = "https://github.com/nvim-lua/plenary.nvim"},
|
||||||
{src = "https://github.com/rktjmp/lush.nvim"},
|
{src = "https://github.com/rktjmp/lush.nvim"},
|
||||||
{src = "https://git.fifthgrid.com/sgraves/darcula_lush"}
|
{src = "https://git.fifthgrid.com/sgraves/darcula_lush"},
|
||||||
|
{src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"},
|
||||||
|
{src = "https://github.com/mason-org/mason-lspconfig.nvim"},
|
||||||
|
{src = "https://github.com/mason-org/mason.nvim"}
|
||||||
}
|
}
|
||||||
|
|
||||||
if NV_DARCULA_ENABLE_COC then
|
if NV_DARCULA_ENABLE_COC then
|
||||||
@@ -81,11 +84,8 @@ else
|
|||||||
{src = "https://github.com/hrsh7th/cmp-path"},
|
{src = "https://github.com/hrsh7th/cmp-path"},
|
||||||
{src = "https://github.com/rafamadriz/friendly-snippets"},
|
{src = "https://github.com/rafamadriz/friendly-snippets"},
|
||||||
{src = "https://github.com/neovim/nvim-lspconfig"},
|
{src = "https://github.com/neovim/nvim-lspconfig"},
|
||||||
{src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"},
|
|
||||||
{src = "https://github.com/akinsho/flutter-tools.nvim"},
|
{src = "https://github.com/akinsho/flutter-tools.nvim"},
|
||||||
{src = "https://github.com/kosayoda/nvim-lightbulb"},
|
{src = "https://github.com/kosayoda/nvim-lightbulb"},
|
||||||
{src = "https://github.com/mason-org/mason-lspconfig.nvim"},
|
|
||||||
{src = "https://github.com/mason-org/mason.nvim"},
|
|
||||||
{src = "https://github.com/ray-x/lsp_signature.nvim"}
|
{src = "https://github.com/ray-x/lsp_signature.nvim"}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ local setup_list =
|
|||||||
require("darcula.utils").get_files_sorted_without_extension(
|
require("darcula.utils").get_files_sorted_without_extension(
|
||||||
vim.fs.joinpath(vim.fn.stdpath("config"), "lua", "darcula", "setup")
|
vim.fs.joinpath(vim.fn.stdpath("config"), "lua", "darcula", "setup")
|
||||||
)
|
)
|
||||||
for _, name in pairs(setup_list) do
|
for _, name in ipairs(setup_list) do
|
||||||
require("darcula.setup." .. name)
|
require("darcula.setup." .. name)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
-- The MIT License (MIT)
|
||||||
|
--
|
||||||
|
-- Copyright © 2026 Scott E. Graves <scott.e.graves@protonmail.com>
|
||||||
|
--
|
||||||
|
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
-- and associated documentation files (the “Software”), to deal in the Software without restriction,
|
||||||
|
-- including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
-- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
-- furnished to do so, subject to the following conditions:
|
||||||
|
--
|
||||||
|
-- The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
-- substantial portions of the Software.
|
||||||
|
--
|
||||||
|
-- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||||
|
-- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
--
|
||||||
|
local symbols = require("darcula.utils.symbols")
|
||||||
|
|
||||||
|
require("mason").setup {
|
||||||
|
install_root_dir = NV_DARCULA_MASON_ROOT,
|
||||||
|
PATH = "prepend",
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
icons = {
|
||||||
|
package_installed = symbols.status.ok,
|
||||||
|
package_pending = symbols.status.checking,
|
||||||
|
package_uninstalled = symbols.status.uninstalled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local ensure_installed = vim.deepcopy(NV_DARCULA_MASON_INST_LIST)
|
||||||
|
vim.list_extend(ensure_installed, NV_DARCULA_MASON_TOOL_LIST)
|
||||||
|
|
||||||
|
local installer = require("mason-tool-installer")
|
||||||
|
installer.setup {
|
||||||
|
ensure_installed = ensure_installed,
|
||||||
|
integrations = {
|
||||||
|
["mason-lspconfig"] = true,
|
||||||
|
["mason-null-ls"] = false,
|
||||||
|
["mason-nvim-dap"] = false
|
||||||
|
},
|
||||||
|
run_on_start = false
|
||||||
|
}
|
||||||
|
installer.check_install(false, true)
|
||||||
@@ -21,29 +21,11 @@ if NV_DARCULA_ENABLE_COC then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local symbols = require("darcula.utils.symbols")
|
|
||||||
---@diagnostic disable-next-line: deprecated
|
---@diagnostic disable-next-line: deprecated
|
||||||
local unpacker = table.unpack or unpack
|
local unpacker = table.unpack or unpack
|
||||||
|
|
||||||
require("mason").setup {
|
|
||||||
ui = {
|
|
||||||
border = "rounded",
|
|
||||||
icons = {
|
|
||||||
package_installed = symbols.status.ok,
|
|
||||||
package_pending = symbols.status.checking,
|
|
||||||
package_uninstalled = symbols.status.uninstalled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup {
|
require("mason-lspconfig").setup {
|
||||||
automatic_enable = NV_DARCULA_MASON_LSP_LIST,
|
automatic_enable = NV_DARCULA_MASON_LSP_LIST
|
||||||
ensure_installed = NV_DARCULA_MASON_INST_LIST
|
|
||||||
}
|
|
||||||
|
|
||||||
require("mason-tool-installer").setup {
|
|
||||||
ensure_installed = NV_DARCULA_MASON_TOOL_LIST,
|
|
||||||
run_on_start = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
@@ -83,13 +65,7 @@ for _, name in pairs(NV_DARCULA_MASON_LSP_LIST) do
|
|||||||
)
|
)
|
||||||
elseif name == "jdtls" then
|
elseif name == "jdtls" then
|
||||||
local lombok =
|
local lombok =
|
||||||
vim.fs.joinpath(
|
vim.fs.joinpath(NV_DARCULA_MASON_ROOT, "packages", "jdtls", "lombok.jar")
|
||||||
vim.fn.stdpath("data"),
|
|
||||||
"mason",
|
|
||||||
"packages",
|
|
||||||
"jdtls",
|
|
||||||
"lombok.jar"
|
|
||||||
)
|
|
||||||
vim.env.JDTLS_JVM_ARGS =
|
vim.env.JDTLS_JVM_ARGS =
|
||||||
table.concat(
|
table.concat(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user