File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ function M.get_config(opts)
31
31
local jdtls_config = path .join (jdtls_root , ' config' )
32
32
local lombok_path = path .join (lombok_root , ' lombok.jar' )
33
33
local equinox_launcher =
34
- path .join (jdtls_root , ' plugins' , ' org.eclipse.equinox.launcher.jar' )
34
+ path .join (jdtls_root , ' plugins' , ' org.eclipse.equinox.launcher.jar' )
35
35
local plugin_paths = plugins .get_plugin_paths (opts .jdtls_plugins )
36
36
local base_config = config .get_config ()
37
37
@@ -70,7 +70,7 @@ function M.get_config(opts)
70
70
71
71
if jdk :is_installed () then
72
72
local java_home =
73
- vim .fn .glob (path . join ( jdk : get_install_path (), ' /jdk-17*' ))
73
+ vim .fn .glob (vim . fn . expand ( ' $MASON/packages/openjdk-17 /jdk-17*' ))
74
74
local java_bin = path .join (java_home , ' /bin' )
75
75
76
76
base_config .cmd_env = {
@@ -108,9 +108,9 @@ function M.get_root_finder(root_markers)
108
108
local fallback_dir = vim .fn .getcwd ()
109
109
log .debug (
110
110
" couldn't find root of "
111
- .. file_name
112
- .. ' using fallback dir '
113
- .. fallback_dir
111
+ .. file_name
112
+ .. ' using fallback dir '
113
+ .. fallback_dir
114
114
)
115
115
return fallback_dir
116
116
end
Original file line number Diff line number Diff line change @@ -6,21 +6,25 @@ local M = {}
6
6
--- @param pkg_name string
7
7
--- @return string | nil
8
8
function M .get_pkg_path (pkg_name )
9
- return mason_registry .get_package (pkg_name ):get_install_path ()
9
+ local mason_data_path = vim .fn .stdpath (" data" ) .. " /mason/packages/" .. pkg_name
10
+ return mason_data_path
10
11
end
11
12
12
- --- Returns true if the package in installed in mason
13
+ --- Returns true if the package is installed in mason
13
14
--- @param pkg_name string
14
15
--- @return boolean
15
16
function M .is_pkg_installed (pkg_name )
16
- return mason_registry .get_package (pkg_name ):is_installed ()
17
+ local ok , pkg = pcall (mason_registry .get_package , pkg_name )
18
+ return ok and pkg :is_installed ()
17
19
end
18
20
19
21
--- Returns the shared artifact path for a given package
20
- --- @param pkg_name string name of the package to get the path of
21
- --- @return string # path to the shared artifact directory of the package
22
+ --- @param pkg_name string
23
+ --- @return string
22
24
function M .get_shared_path (pkg_name )
23
- return vim .fn .glob (' $MASON/share/' .. pkg_name )
25
+ local mason_share_path = vim .fn .stdpath (" data" ) .. " /mason/share/" .. pkg_name
26
+ return mason_share_path
24
27
end
25
28
26
29
return M
30
+
You can’t perform that action at this time.
0 commit comments