Closed caamittiwari closed 1 year ago
The error message seems pretty clear:
[ERROR][2023-04-19 11:29:25] .../vim/lsp/rpc.lua:734 "rpc" "java" "stderr" "Error opening zip file or JAR manifest missing : /home/amit/.local/share/nvim/mason/packages/jdtls/plugins/lombok.jar\n"
[START][2023-04-19 07:15:51] LSP logging initiated [ERROR][2023-04-19 07:15:51] .../vim/lsp/rpc.lua:734 "rpc" "java" "stderr" "Error: Unable to access jarfile \n"
Make sure the files exist and are accessible.
The issue tracker is for bugs, not for debugging support of configurations Also for next time, please use proper markdown formatting. Your configuration is unreadable as it's posted.
thanks for reply
I have checked all file is but unable access as all configuration is ok there is bug in plugin as not working Neovim 9 version ;
i got the error but same code work for other lower version of python as some code written in python (elipse -jtls) ; any small update break the code ,
Thanks
LSP client configuration
vim.opt_local.shiftwidth = 2 vim.opt_local.tabstop = 2 vim.opt_local.cmdheight = 2 -- more space in the neovim command line for displaying messages
local capabilities = vim.lsp.protocol.make_client_capabilities()
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") if not status_cmp_ok then return end capabilities.textDocument.completion.completionItem.snippetSupport = false capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
local status, jdtls = pcall(require, "jdtls") if not status then vim.notify "JDTLS not found, install with
:LspInstall jdtls
" return end -- Installation location of jdtls by nvim-lsp-installer -- local JDTLS_LOCATION = "/usr/share/jdtls"-- hard code location local JDTLS_LOCATION = vim.fn.stdpath "data" .. "/mason/packages/jdtls" -- std path for nvim eg(:echo stdpath("config"))-- Determine OS local home = (os.getenv "HOME") if vim.fn.has "mac" == 1 then WORKSPACE_PATH = home .. "/workspace/" CONFIG = "mac" elseif vim.fn.has "unix" == 1 then WORKSPACE_PATH = home .."/.cache".. "/workspace/" CONFIG = "linux" else print "Unsupported system" end
-- Find root of project local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" } local root_dir = require("jdtls.setup").find_root(root_markers) if root_dir == "" then return end
local extendedClientCapabilities = jdtls.extendedClientCapabilities extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local workspace_dir = WORKSPACE_PATH .. project_name
-- TODO: Testing
-- -- JAVA_DAP_ACTIVE -- JAVA_DAP_ACTIVE = true
-- -- local bundles = {}
-- if JAVA_DAP_ACTIVE then -- vim.list_extend(bundles, vim.split(vim.fn.glob(home .. "/.config/nvim/vscode-java-test/server/.jar"), "\n")) -- vim.list_extend( -- bundles, -- vim.split( -- vim.fn.glob( -- home .. "/.config/nvim/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-.jar" -- ), -- "\n" -- ) -- ) -- end
-- See
:help vim.lsp.start_client
for an overview of the supportedconfig
options. local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = {},
on_attach = require("lsp_config.lsp").on_attach, capabilities = capabilities,
-- 💀 -- This is the default if not provided, you can remove it. Or adjust as needed. -- One dedicated LSP server & client will be started per unique root_dir root_dir = root_dir,
-- Here you can configure eclipse.jdt.ls specific settings -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request -- or https://github.com/redhat-developer/vscode-java#supported-vs-code-settings -- for a list of options settings = { java = { -- jdt = { -- ls = { -- vmargs = "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m" -- } -- }, eclipse = { downloadSources = true, }, configuration = { updateBuildConfiguration = "interactive", }, maven = { downloadSources = true, }, implementationsCodeLens = { enabled = true, }, referencesCodeLens = { enabled = true, }, references = { includeDecompiledSources = true, }, inlayHints = { parameterNames = { enabled = "all", -- literals, all, none }, }, format = { enabled = true, settings = {home .. "/.config/nvim/lang-servers/intellij-java-google-style.xml", profile = "GoogleStyle", } }, }, signatureHelp = { enabled = true }, completion = { favoriteStaticMembers = { "org.hamcrest.MatcherAssert.assertThat", "org.hamcrest.Matchers.", "org.hamcrest.CoreMatchers.", "org.junit.jupiter.api.Assertions.", "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.", }, }, contentProvider = { preferred = "fernflower" }, extendedClientCapabilities = extendedClientCapabilities, sources = { organizeImports = { starThreshold = 9999, staticStarThreshold = 9999, }, }, codeGeneration = { toString = { template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}", }, useBlocks = true, }, },
flags = { allow_incremental_sync = true, },
-- Language server
initializationOptions
-- You need to extend thebundles
with paths to jar files -- if you want to use additional eclipse.jdt.ls plugins.-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this -- init_options = { -- bundles = {}, -- bundles = bundles, -- }, }
-- This starts a new client & server, -- or attaches to an existing client & server depending on the
root_dir
. require("jdtls").start_or_attach(config)-- require('jdtls').setup_dap()
vim.cmd "command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile()"
vim.cmd "command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime()"
vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()"
-- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"
vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()"
-- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
local status_ok, which_key = pcall(require, "which-key") if not status_ok then return end
local opts = { mode = "n", -- NORMAL mode prefix = "",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use
silent
when creating keymaps noremap = true, -- usenoremap
when creating keymaps nowait = true, -- usenowait
when creating keymaps }local vopts = { mode = "v", -- VISUAL mode prefix = "",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use
silent
when creating keymaps noremap = true, -- usenoremap
when creating keymaps nowait = true, -- usenowait
when creating keymaps }local mappings = { L = { name = "Java", o = { "lua require'jdtls'.organize_imports()", "Organize Imports" },
v = { "lua require('jdtls').extract_variable()", "Extract Variable" },
c = { "lua require('jdtls').extract_constant()", "Extract Constant" },
t = { "lua require'jdtls'.test_nearest_method()", "Test Method" },
T = { "lua require'jdtls'.test_class()", "Test Class" },
u = { "JdtUpdateConfig", "Update Config" },
},
}
local vmappings = { L = { name = "Java", v = { "lua require('jdtls').extract_variable(true)", "Extract Variable" },
c = { "lua require('jdtls').extract_constant(true)", "Extract Constant" },
m = { "lua require('jdtls').extract_method(true)", "Extract Method" },
},
}
which_key.register(mappings, opts) which_key.register(vmappings, vopts)
-- debugging -- git clone git@github.com:microsoft/java-debug.git
Eclipse.jdt.ls version
version -1.22.0
Steps to Reproduce
server has to work which working other version but not with neovim version 9 i have checked my configuration its look ok and i use some other person configuration result is same jdtShowlog giving following error [START][2023-04-19 11:29:25] LSP logging initiated [ERROR][2023-04-19 11:29:25] .../vim/lsp/rpc.lua:734 "rpc" "java" "stderr" "Error opening zip file or JAR manifest missing : /home/amit/.local/share/nvim/mason/packages/jdtls/plugins/lombok.jar\n" and some time its show following error [START][2023-04-19 07:15:51] LSP logging initiated [ERROR][2023-04-19 07:15:51] .../vim/lsp/rpc.lua:734 "rpc" "java" "stderr" "Error: Unable to access jarfile \n"
i have done all thing including reinstalling jdk and jdtls server ; Please advice
Expected Result
server has to work
Actual Result
:lua require('jdtls').compile('full') say