Apply suggestions from code review

suggestions by @williamboman and @TheDSCPL

Co-authored-by: William Boman <william@redwill.se>
Co-authored-by: Luis Durão <kpvrzlzzx@mozmail.com>
This commit is contained in:
Iordanis Petkakis 2025-05-14 11:42:51 +03:00 committed by GitHub
parent 0585eeac05
commit 64c4e501c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -152,13 +152,13 @@ return {
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
local java_dbg_path = LazyVim.get_pkg_path("java-debug-adapter") local java_dbg_path = LazyVim.get_pkg_path("java-debug-adapter")
local jar_patterns = { local jar_patterns = {
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", vim.fn.expand "$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin-*.jar",
} }
-- java-test also depends on java-debug-adapter. -- java-test also depends on java-debug-adapter.
if opts.test and mason_registry.is_installed("java-test") then if opts.test and mason_registry.is_installed("java-test") then
local java_test_path = LazyVim.get_pkg_path("java-test") local java_test_path = LazyVim.get_pkg_path("java-test")
vim.list_extend(jar_patterns, { vim.list_extend(jar_patterns, {
java_test_path .. "/extension/server/*.jar", vim.fn.expand "$MASON/share/java-test/*.jar",
}) })
end end
for _, jar_pattern in ipairs(jar_patterns) do for _, jar_pattern in ipairs(jar_patterns) do

View file

@ -196,7 +196,7 @@ return {
local have_mason, mlsp = pcall(require, "mason-lspconfig") local have_mason, mlsp = pcall(require, "mason-lspconfig")
local all_mslp_servers = {} local all_mslp_servers = {}
if have_mason and vim.fn.has("nvim-0.11") == 1 then if have_mason and vim.fn.has("nvim-0.11") == 1 then
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig").get_mappings().lspconfig_to_package) all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings").get_mason_map().lspconfig_to_package)
elseif have_mason then elseif have_mason then
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
end end

View file

@ -253,7 +253,7 @@ function M.get_pkg_path(pkg, path, opts)
opts = opts or {} opts = opts or {}
opts.warn = opts.warn == nil and true or opts.warn opts.warn = opts.warn == nil and true or opts.warn
path = path or "" path = path or ""
local ret = root .. "/packages/" .. pkg .. path local ret = vim.fs.normalize(root .. "/packages/" .. pkg .. "/" .. path)
if opts.warn and not vim.loop.fs_stat(ret) and not require("lazy.core.config").headless() then if opts.warn and not vim.loop.fs_stat(ret) and not require("lazy.core.config").headless() then
M.warn( M.warn(
("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(pkg, path) ("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(pkg, path)