Skip to content
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

LSP not working with Gradle Kotlin build script DSL #3128

Open
lescx opened this issue Apr 5, 2024 · 1 comment
Open

LSP not working with Gradle Kotlin build script DSL #3128

lescx opened this issue Apr 5, 2024 · 1 comment

Comments

@lescx
Copy link

lescx commented Apr 5, 2024

Currently, when setting up a new Gradle project with Kotlin as the build script DSL (which is the default), the jdt.ls does not work.

Steps to reproduce

  1. Initialize a new Gradle project with default values and Java target version 17:
$ gradle init

[…]

Enter target Java version (min: 7, default: 21): 17

[…]
  1. Open a .java file in the project in Helix and hover with the cursor over e.g. a class:

image

Expected behaviour

When choosing Groovy instead of Kotlin, the LSP does its job and auto-completions etc. work:

image

Versions

  • jdtls 1.34.0; build from source
  • OpenJDK Runtime Environment (build 17.0.10+7-Debian-1)
  • Gradle 8.7
  • Debian testing (trixie)
  • Kernel 6.6.17-01102-gd3cec3c11146
  • Helix 24.3 (2cadec0b)

LSP/Helix Logs

  • hx app/src/main/java/org/example/App.java
  • wait until LSP is fully loaded
  • Hover over System class
  • Get no documentation
  • Close editor :q
~/.cache/helix/helix.log
2024-04-05T23:09:10.398 helix_lsp::transport [ERROR] jdtls err <- "WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector\n"
2024-04-05T23:09:10.797 helix_lsp::transport [ERROR] jdtls err <- "Apr 05, 2024 11:09:10 PM org.apache.aries.spifly.BaseActivator log\n"
2024-04-05T23:09:10.797 helix_lsp::transport [ERROR] jdtls err <- "INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\n"
2024-04-05T23:09:10.800 helix_lsp::transport [ERROR] jdtls err <- "Apr 05, 2024 11:09:10 PM org.apache.aries.spifly.BaseActivator log\n"
2024-04-05T23:09:10.800 helix_lsp::transport [ERROR] jdtls err <- "INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\n"
2024-04-05T23:09:14.603 helix_term::application [WARN] Ignoring a client/registerCapability request because dynamic capability registration is not enabled. Please report this upstream to the language server
2024-04-05T23:09:17.206 helix_lsp::client [WARN] language server failed to terminate gracefully - failed to parse: invalid type: map, expected unit
@rofe33
Copy link

rofe33 commented Apr 9, 2024

The same goes for jdtls on neovim. If the project was initialized with gradle and kotlin as build script DSL. The jdtls doesn't work. However, if the project is created with gradle and groovy jdtls will work, and it will work with mvn. Also if the file is a non-project file, the jdtls will work and tell us.

Versions

  • neovim: NVIM v0.9.5
  • jdtls: v1.33.0 (installed using mason, from the eclipse website)
  • gradle 8.7
  • Kernel: linux-lts 6.6.25-1

Jdtls log

[ERROR][2024-04-09 17:08:08] ...lsp/handlers.lua:535	"Apr 9, 2024, 5:08:08 PM file:///home/user/project/app/src/main/java/org/example/App.java does not resolve to a ICompilationUnit"

Note: I am new to java, gradle... However, for some unknown reasons, after trying groovy. The jdtls worked with build script kotlin. However, I was stuck like 2 hours trying to figure out, why jdtls is not working when I am using gradle.

@lescx lescx changed the title LSP not working on Helix with Gradle Kotlin build script DSL LSP not working with Gradle Kotlin build script DSL Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants