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

import source actions for java (jdtls) don't work #5421

Closed
rzeigler opened this issue Jan 6, 2023 · 8 comments
Closed

import source actions for java (jdtls) don't work #5421

rzeigler opened this issue Jan 6, 2023 · 8 comments
Labels
A-language-server Area: Language server client A-plugin Area: Plugin system C-bug Category: This is a bug

Comments

@rzeigler
Copy link

rzeigler commented Jan 6, 2023

Summary

Attempting to use a to import a missing classes does nothing and gives no feedback.
The classes that should be importable are shown in the menu popup for the import single option.
Additionally, selecting a completion option does does cause the import to appear.

I reproduced this with a minimal project containing 2 classes.
There do appear to be interesting messages in helix.log attached below.

In the attached helix.log the first log message that occurs on source action is the message from helix_term::commands::lsp

Reproduction Steps

See recording at https://asciinema.org/a/5iISIPMQuUoCrTFA4UirtTn7O

Starting from a minimal maven project with a pom and 2 classes I

  1. Write an expression in 1 class that references the other class (in a different package).
  2. Navigate to the diagnostic
  3. <space>a
  4. Choose import or import all

Nothing happens.

Helix log

~/.cache/helix/helix.log
2023-01-05T20:13:56.677 helix_term::application [ERROR] Language Server: Method not found client/registerCapability
2023-01-05T20:14:31.873 helix_lsp::transport [ERROR] err <- "WARNING: Using incubator modules: jdk.incubator.concurrent, jdk.incubator.vector\n"
2023-01-05T20:14:32.906 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:32.907 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.215 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.417 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.446 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.446 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.447 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.460 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-01-05T20:14:33.502 helix_term::application [ERROR] Language Server: Method not found client/registerCapability
2023-01-05T20:14:33.506 helix_term::application [ERROR] Language Server: Method not found workspace/executeClientCommand
2023-01-05T20:14:37.478 helix_lsp::transport [ERROR] <- MethodNotFound: No delegateCommandHandler for java.apply.workspaceEdit
2023-01-05T20:14:37.478 helix_term::commands::lsp [ERROR] execute LSP command: protocol error: MethodNotFound: No delegateCommandHandler for java.apply.workspaceEdit
2023-01-05T20:14:40.296 helix_lsp::transport [ERROR] <- MethodNotFound: No delegateCommandHandler for java.apply.workspaceEdit
2023-01-05T20:14:40.297 helix_term::commands::lsp [ERROR] execute LSP command: protocol error: MethodNotFound: No delegateCommandHandler for java.apply.workspaceEdit
2023-01-05T20:15:07.800 helix_lsp::client [WARN] language server failed to terminate gracefully - failed to parse: invalid type: map, expected unit

Platform

macOS

Terminal Emulator

wezterm version: 20221119-145034-49b9839f

Helix Version

helix 22.12 (96ff64a)

@rzeigler rzeigler added the C-bug Category: This is a bug label Jan 6, 2023
@rzeigler rzeigler changed the title import source actions for java (jdtls) doesn't work import source actions for java (jdtls) don't work Jan 6, 2023
@the-mikedavis
Copy link
Member

The log line:

2023-01-05T20:14:33.506 helix_term::application [ERROR] Language Server: Method not found workspace/executeClientCommand

is relevant.

It looks like jdtls is using an extension to the LSP spec to tell the client how to execute commands workspace/executeClientCommand (eclipse-jdtls/eclipse.jdt.ls#596). This isn't part of the LSP spec though so this would be a language-specific extension (those belong in plugin-territory).

@the-mikedavis the-mikedavis added A-language-server Area: Language server client A-plugin Area: Plugin system labels Jan 6, 2023
@rayanpiro
Copy link

rayanpiro commented Feb 8, 2023

Same here.

Helix version 22.12, using OpenSuse Tumbleweed and jdtls 1.19.0 installed with brew.

The helix.log file:
2023-02-08T10:55:50.186 helix_lsp::transport [ERROR] err <- "WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.concurrent\n" 2023-02-08T10:55:52.258 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled 2023-02-08T10:55:52.259 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled 2023-02-08T10:55:52.310 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled 2023-02-08T10:55:52.345 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled 2023-02-08T10:55:52.376 helix_term::application [ERROR] Language Server: Method not found client/registerCapability

Is an issue on jdtls?

Thanks 😄

@pascalkuthe
Copy link
Member

Sounds like the LS is trying to perform dynamic capability registration. Helix does not set the appropriate client capabilities (dynamicRegistration) and therefore does not support this feature. According to the LSP spec the server is not allowed to send these requests in that case so that is an upstream issue.
However I am not sure if that is really causing the issue here although it is quite likely since the server also seems to.be sending other unhandeled requests, which likely habe to do with additional unregistered capabilities

@rzeigler
Copy link
Author

Is there anything I can do to attempt to gather more information?

@cstich
Copy link

cstich commented Feb 18, 2023

Upstream have an ancient issue about this. Apparently the vscode client depends on the non-spec behavior, so they refuse to fix it.

@theli-ua
Copy link
Contributor

FWIW I posted a PR to jdtls to fix this but there hasn't been any feedback for a while
eclipse-jdtls/eclipse.jdt.ls#2688

@theli-ua
Copy link
Contributor

since the linked PR doesn't get any replies for a month now, I've temporarily published a build of that commit over here in case anyone wants to test: https://github.com/theli-ua/eclipse.jdt.ls/releases/tag/java.apply.WorkspaceEdit

@rzeigler
Copy link
Author

I'm going to close this. It appears to be working for me with 23.10 and jdtls: stable 1.30.1 (bottled). Its a little bit confusing, because it seems the the replacement PR for the linked one hasn't been merged yet but 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client A-plugin Area: Plugin system C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

6 participants