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

Lots of errors appearing in auto-generated projects by gradle #315

Closed CMOISDEAD closed 2 years ago

CMOISDEAD commented 2 years ago

LSP client configuration

local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = {

-- 💀
"java", -- or '/path/to/java17_or_newer/bin/java'
-- depends on if `java` is in your $PATH env variable and if it points to the right version.

"-Declipse.application=org.eclipse.jdt.ls.core.id1",
"-Dosgi.bundles.defaultStartLevel=4",
"-Declipse.product=org.eclipse.jdt.ls.core.product",
"-Dlog.protocol=true",
"-Dlog.level=ALL",
"-Xms1g",
"--add-modules=ALL-SYSTEM",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",

-- 💀
"-jar",
"/home/camilo/.config/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar",
-- "/path/to/jdtls_install_location/plugins/org.eclipse.equinox.launcher_VERSION_NUMBER.jar",
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                       ^^^^^^^^^^^^^^
-- Must point to the                                                     Change this to
-- eclipse.jdt.ls installation                                           the actual version

-- 💀
"-configuration",
"/home/camilo/.config/jdtls/config_linux/",
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        ^^^^^^
-- Must point to the                      Change to one of `linux`, `win` or `mac`
-- eclipse.jdt.ls installation            Depending on your system.

-- 💀
-- See `data directory configuration` section in the README
"-data",
workspace_dir,

},

-- 💀 -- 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 = require("jdtls.setup").find_root { ".git", "mvnw", "gradlew", "build.gradle" },

-- 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 -- for a list of options settings = { java = {}, },

-- Language server initializationOptions -- You need to extend the bundles 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 = {}, }, }

Eclipse.jdt.ls version

No response

Steps to Reproduce

Create a project with gradle init, open App.java

Expected Result

No errors :)

Actual Result

2022-09-03-091837_1366x768_scrot

thanks for the help

mfussenegger commented 2 years ago

Sounds like it can't find the right jdk for the project. You need to configure the runtime languages, see https://github.com/mfussenegger/nvim-jdtls#java-xy-language-features-are-not-available