add config
This commit is contained in:
31
ftplugin/java.lua
Normal file
31
ftplugin/java.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
-- Simplified debug info that doesn't rely on mason-registry
|
||||
local function inspect_jdtls_installation()
|
||||
local mason_path = vim.fn.stdpath "data" .. "/mason"
|
||||
local jdtls_path = mason_path .. "/packages/jdtls"
|
||||
print("JDTLS package path: " .. jdtls_path)
|
||||
|
||||
local launcher_jar = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar")
|
||||
print("Launcher JAR: " .. (launcher_jar ~= "" and launcher_jar or "NOT FOUND"))
|
||||
|
||||
local config_dir = jdtls_path .. "/config_linux"
|
||||
if vim.fn.has "mac" == 1 then
|
||||
config_dir = jdtls_path .. "/config_mac"
|
||||
elseif vim.fn.has "win32" == 1 then
|
||||
config_dir = jdtls_path .. "/config_win"
|
||||
end
|
||||
print("Config dir: " .. (vim.fn.isdirectory(config_dir) == 1 and config_dir or "NOT FOUND"))
|
||||
end
|
||||
|
||||
-- Call this before setting up jdtls
|
||||
inspect_jdtls_installation()
|
||||
|
||||
-- Then setup as usual
|
||||
require("configs.java").setup()
|
||||
|
||||
-- Use pcall to safely require jdtls module
|
||||
local status, _ = pcall(require, "jdtls")
|
||||
if status then
|
||||
require("configs.java").setup_jdtls()
|
||||
else
|
||||
print "JDTLS module not found. Make sure nvim-jdtls is installed."
|
||||
end
|
||||
Reference in New Issue
Block a user