fix: update mason API usage for nvim-java compatibility - #89
Conversation
|
@s1n7ax merging this PR is also necessary. |
@Coding4Hours I don't give a shit wtf you are training for. Don't know how branches work? Then stop trying you will be replaced by AI in few months anyway |
| ---@return string | nil | ||
| function M.get_pkg_path(pkg_name) | ||
| return mason_registry.get_package(pkg_name):get_install_path() | ||
| local mason_data_path = vim.fn.stdpath("data") .. "/mason/packages/" .. pkg_name |
There was a problem hiding this comment.
In prev you used $MASON variable but here get stdpath?
| ---@return string | ||
| function M.get_shared_path(pkg_name) | ||
| return vim.fn.glob('$MASON/share/' .. pkg_name) | ||
| local mason_share_path = vim.fn.stdpath("data") .. "/mason/share/" .. pkg_name |
There was a problem hiding this comment.
Can't we use $MASON env variable?
|
Release notes states that the way to get the path is using |
|
Thank you very much for the hard work here. If I may ask, what would it take to push this PR through. It would be great to unblock the mason backward compatibility problem. |

Summary
This PR updates deprecated Mason APIs (
get_install_path) used innvim-java-coreto work with Mason v2.2.0+.Changes
init.luainls/servers/jdtlsto usevim.fn.expand("$MASON/…")for finding JDK paths.utils/mason.luato replace deprecated Mason API calls with standard path functions (vim.fn.stdpath).get_packagewithpcallto avoid crashes when packages are not installed.Motivation
Recent versions of
mason.nvimremoved or changed theget_install_path()method, breaking integration withnvim-java. This patch restores compatibility.Testing
Tested with: