Skip to content

Migrate to official mason repo #95

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions lua/java-core/ls/servers/jdtls/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local config = require('java-core.ls.servers.jdtls.config')
local log = require('java-core.utils.log')
local mason = require('java-core.utils.mason')
local mason_reg = require('mason-registry')
local path = require('java-core.utils.path')
local plugins = require('java-core.ls.servers.jdtls.plugins')
local util = require('lspconfig.util')
Expand All @@ -26,10 +25,9 @@ function M.get_config(opts)
-- pick the OS at runtime because mason.nvim does that for me at the
-- installation
local jdtls_root = mason.get_shared_path('jdtls')
local lombok_root = mason.get_shared_path('lombok-nightly')

local jdtls_config = path.join(jdtls_root, 'config')
local lombok_path = path.join(lombok_root, 'lombok.jar')
local lombok_path = path.join(jdtls_root, 'lombok.jar')
local equinox_launcher =
path.join(jdtls_root, 'plugins', 'org.eclipse.equinox.launcher.jar')
local plugin_paths = plugins.get_plugin_paths(opts.jdtls_plugins)
Expand Down Expand Up @@ -65,20 +63,6 @@ function M.get_config(opts)
utils.get_workspace_path(),
}

if opts.use_mason_jdk then
local jdk = mason_reg.get_package('openjdk-17')

if jdk:is_installed() then
local java_home = vim.fn.glob('$MASON/packages/jdk-17*')
local java_bin = path.join(java_home, '/bin')

base_config.cmd_env = {
['PATH'] = vim.fn.getenv('PATH') .. ':' .. java_bin,
['JAVA_HOME'] = java_home,
}
end
end

---@diagnostic disable-next-line: assign-type-mismatch
base_config.root_dir = M.get_root_finder(opts.root_markers)
base_config.init_options.bundles = plugin_paths
Expand Down
2 changes: 1 addition & 1 deletion lua/java-core/ls/servers/jdtls/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local plug_jar_map = {
'com.microsoft.java.test.plugin-*.jar',
},
['java-debug-adapter'] = { '*.jar' },
['spring-boot-tools'] = { 'jars/*.jar' },
['vs-code-spring-boot-tools'] = { 'jars/*.jar' },
}

---Returns a list of .jar file paths for given list of jdtls plugins
Expand Down