-
Notifications
You must be signed in to change notification settings - Fork 6
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 our terms of service and privacy 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?
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.
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.
@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 |
@@ -6,21 +6,25 @@ local M = {} | |||
---@param pkg_name string | |||
---@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.
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 get stdpath
?
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.
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 |
Summary
This PR updates deprecated Mason APIs (
get_install_path
) used innvim-java-core
to work with Mason v2.2.0+.Changes
init.lua
inls/servers/jdtls
to usevim.fn.expand("$MASON/…")
for finding JDK paths.utils/mason.lua
to replace deprecated Mason API calls with standard path functions (vim.fn.stdpath
).get_package
withpcall
to avoid crashes when packages are not installed.Motivation
Recent versions of
mason.nvim
removed or changed theget_install_path()
method, breaking integration withnvim-java
. This patch restores compatibility.Testing
Tested with: