fix(mason): conform to v2 changes

This commit is contained in:
Iordanis Petkakis 2025-05-08 20:17:39 +03:00
parent cb223553ff
commit 8a52e1bf75
24 changed files with 84 additions and 54 deletions

View file

@ -56,7 +56,7 @@ return {
end,
dependencies = {
{
"williamboman/mason.nvim",
"mason-org/mason.nvim",
opts = { ensure_installed = { "java-debug-adapter", "java-test" } },
},
},
@ -87,8 +87,7 @@ return {
opts = function()
local cmd = { vim.fn.exepath("jdtls") }
if LazyVim.has("mason.nvim") then
local mason_registry = require("mason-registry")
local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar"
local lombok_jar = LazyVim.get_pkg_path("jdtls", "/lombok.jar")
table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar))
end
return {
@ -151,15 +150,13 @@ return {
if LazyVim.has("mason.nvim") then
local mason_registry = require("mason-registry")
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
local java_dbg_path = java_dbg_pkg:get_install_path()
local java_dbg_path = LazyVim.get_pkg_path("java-debug-adapter")
local jar_patterns = {
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
}
-- java-test also depends on java-debug-adapter.
if opts.test and mason_registry.is_installed("java-test") then
local java_test_pkg = mason_registry.get_package("java-test")
local java_test_path = java_test_pkg:get_install_path()
local java_test_path = LazyVim.get_pkg_path("java-test")
vim.list_extend(jar_patterns, {
java_test_path .. "/extension/server/*.jar",
})