mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
1.09k stars 62 forks source link

Missing editor commands #393

Closed IOU4 closed 1 year ago

IOU4 commented 1 year ago

LSP client configuration

local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local workspace_dir = jdtls_workspace_path .. project_name
local config = {
    cmd = {
        "java",
        "-jar", jdtls_path .. "plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar",
        "-configuration", jdtls_path .. "config_linux",
        "-data", workspace_dir,
    },
    root_dir = vim.fs.dirname(vim.fs.find({ ".gradlew", ".git", "mvnw" }, { upward = true })[1]),
    on_attach = require("user.lang_servers").on_attach, -- general lsp keymaps
    lsp_flags = require("user.lang_servers").lsp_flags, -- debounce text
}
jdtls.start_or_attach(config)

Eclipse.jdt.ls version

1.18.0

Steps to Reproduce

In a project using Gradle 7.5.1 open a .java file

Expected Result

Editor Commands: JdtUpadteConfig, JdtJshell, JdtSetRuntime, JdtRestart to be available

Actual Result

Only JdtShowLogs and JdtWipeDataAndRestart that are available.

IOU4 commented 1 year ago

lsp.log

[WARN][2022-12-20 11:14:46] .../lua/vim/lsp.lua:1072    "server_request: no handler found for"  "workspace/inlayHint/refresh"
[WARN][2022-12-20 11:14:46] ...lsp/handlers.lua:113 "The language server jdtls triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2022-12-20 11:14:46] ...lsp/handlers.lua:485    "Dec 20, 2022, 11:14:46 AM class com.google.gson.internal.LinkedTreeMap cannot be cast to class java.util.ArrayList (com.google.gson.internal.LinkedTreeMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3e821657; java.util.ArrayList is in module java.base of loader 'bootstrap')\nclass com.google.gson.internal.LinkedTreeMap cannot be cast to class java.util.ArrayList (com.google.gson.internal.LinkedTreeMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3e821657; java.util.ArrayList is in module java.base of loader 'bootstrap')\njava.lang.ClassCastException: class com.google.gson.internal.LinkedTreeMap cannot be cast to class java.util.ArrayList (com.google.gson.internal.LinkedTreeMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3e821657; java.util.ArrayList is in module java.base of loader 'bootstrap')\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.synchronizeBundles(JDTLanguageServer.java:387)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer$2.run(JDTLanguageServer.java:285)\n\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)\n"

jdtls.log everything looks fine except for this at the end

!ENTRY org.eclipse.jdt.ls.core 4 0 2022-12-20 11:33:09.113
!MESSAGE class com.google.gson.internal.LinkedTreeMap cannot be cast to class java.util.ArrayList (com.google.gson.internal.LinkedTreeMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3e821657; java.util.ArrayList is in module java.base of loader 'bootstrap')
!STACK 0
java.lang.ClassCastException: class com.google.gson.internal.LinkedTreeMap cannot be cast to class java.util.ArrayList (com.google.gson.internal.LinkedTreeMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3e821657; java.util.ArrayList is in module java.base of loader 'bootstrap')
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.synchronizeBundles(JDTLanguageServer.java:387)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer$2.run(JDTLanguageServer.java:285)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
mfussenegger commented 1 year ago

Those commands are currently not added by default. You can add them by calling require('jdtls.setup').add_commands() in your on_attach hook or LspAttach autocmd.

See https://github.com/mfussenegger/nvim-jdtls#usage

IOU4 commented 1 year ago

thank you