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

Java jdt.ls with Bazel project: Diagnostics going crazy; number spins up and down #21265

Open
1 task done
fzakaria opened this issue Nov 28, 2024 · 6 comments
Open
1 task done
Labels
bug [core label] diagnostics Feedback for diagnostics, error messages, logs, etc java Java programming language support language server failure Language server doesn't work as expected upstream

Comments

@fzakaria
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

The diagnostic pane and number in the editor is non-stop changing.

A video is pretty good to see.
I wish you could hear the fan!

Not sure how to debug it; hopefully something in the logs.

Screencast.from.2024-11-27.20-17-38.webm

perhaps what is notable, I am not using git for my project but jj (jujutsu)
I see a lot of errors in the logs about not being a worktree.

Environment

Zed: v0.162.5 (Zed)
OS: Linux X11 nixos 24.05
Memory: 60.6 GiB
Architecture: x86_64
GPU: AMD Radeon Graphics (RADV GFX1103_R1) || radv || Mesa 24.0.7

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

Zed.log.txt

@fzakaria fzakaria added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Nov 28, 2024
@notpeter
Copy link
Member

Wow. That's spooky looking. Which java extension do you have installed:

Do you perhaps have them both installed? (don't)
Do you have a project that I would be able to reproduce this with (e.g. does this happen with every java project or is there something bad about this one).

There's a few more docs here:

@notpeter notpeter added needs info / awaiting response Issue that needs more information from the user java Java programming language support and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 13, 2024
@fzakaria
Copy link
Author

I only had the first extension installed.
The "unique" thing I could think of was that I was working in a Bazel project layout; so it did not follow standard Maven layout.

I would guess it's a problem with the jdtls that they both use.

@notpeter
Copy link
Member

notpeter commented Dec 16, 2024

I would love to try and track down what triggers this, especially since this is a Bazel project as that's something we'd like to better support in Zed, but it appears JDTLS doesn't directly support Bazel workspaces. Although there are Extensions for Eclipse (salesforce/bazel-eclipse) and VSCode (salesforce/bazel-vscode-java) both seem to a bunch of heavy lifting to act as the glue between the JDTLS, Bazel and the Language Server Client (the IDE).

There seems to be little upstream interest in directly integrating support for Bazel workspaces in JDTLS as there has been little issue activity other than a few dead-end unmerged PRs. :(

Personally, I don't have experience with Bazel. I have owned CI toolchains for supporting various products in the Java-ecosystem, but insufficient knowledge/experience with jdtls to implement a solution.

I would love to try and reproduce -- if you know of an open source project or toy repo which demonstrates the incorrect behavior I'd love see if we can fix Zed diagnostic counter going nuts, even if we can't fully support Bazel projects with JDTLS under Zed.

In the absence of that, I think I have to close -- without the ability to reproduce and it being unsupported upstream, that's not much we can do.

Sorry you're having a bad time with this.
Let me know if you have any other suggestions/ideas for what direction to take this.

@notpeter notpeter changed the title Diagnostics going crazy on my laptop; number just spinning up and down. Java jdt.ls with Bazel project: Diagnostics going crazy; number spins up and down Dec 16, 2024
@notpeter notpeter added diagnostics Feedback for diagnostics, error messages, logs, etc language server failure Language server doesn't work as expected labels Dec 16, 2024
@fzakaria
Copy link
Author

fzakaria commented Dec 16, 2024

I just shared the repo with you that I experienced it on; try it if you can reproduce.
Notably I'm on NixOS but I don't think any of the NixOS things interfere with that.

The repository includes a flake.nix that you should be able to use.
Reproduction steps:

cd <repository>
$ nix develop
# from same terminal
$ zeditor .

@notpeter
Copy link
Member

Thanks @fzakaria I dug up what I think are the required settings for supporting Bazel with JDTLS. I haven't yet had a chance to test them with your repo, but it's on my todo. If you want to give it a whirl in the meantime, I've documented my research here:

@notpeter notpeter removed the needs info / awaiting response Issue that needs more information from the user label Dec 17, 2024
@fzakaria
Copy link
Author

Cool thanks;
I was reading somewhere on jdtls and it had options for a "workspace" setting also for projects that don't adopt Maven source layout.

In any case, I felt the bug was more about: "Look at this crazy amount of spinning that happens when no settings are made"
I like the approach to making Bazel work with separate settings though !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] diagnostics Feedback for diagnostics, error messages, logs, etc java Java programming language support language server failure Language server doesn't work as expected upstream
Projects
None yet
Development

No branches or pull requests

2 participants