- Notifications
You must be signed in to change notification settings - Fork10
fix: update mason API usage for nvim-java compatibility#89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
gierdo commentedMay 11, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You can install mason in version 1.x, or alternatively use nvim-java-compatibility from Kabil777's fork. How you can do that depends on you plugin manager and your configuration, though. So it's a bit hard to guide you. With lazy, e.g., you can do Or you can apply the fix proposed here: LazyVim/LazyVim#6053 (comment) Or you can do this: |
This comment was marked as abuse.
This comment was marked as abuse.
Zeioth commentedMay 11, 2025
@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 |
| ---@returnstring|nil | ||
| functionM.get_pkg_path(pkg_name) | ||
| returnmason_registry.get_package(pkg_name):get_install_path() | ||
| localmason_data_path=vim.fn.stdpath("data").."/mason/packages/"..pkg_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In prev you used $MASON variable but here getstdpath?
| ---@returnstring | ||
| functionM.get_shared_path(pkg_name) | ||
| returnvim.fn.glob('$MASON/share/'..pkg_name) | ||
| localmason_share_path=vim.fn.stdpath("data").."/mason/share/"..pkg_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can't we use $MASON env variable?
Release notes states that the way to get the path is using |
ahakanbaba commentedMay 28, 2025
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. |
@ahakanbaba The last time I accepted a mason 2.0 compatibility PR, it was broken on mason 1.0 as well as on mason 2.0. Now that I have some time to think about it, the changes should think about backward compatibility as well. I think I should do this myself but at the same time I don't have much time. too busy with personal stuff. |
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: