spring-projects / spring-projects/spring-tools

classpath listeners are sometimes not being notified

Open
#848 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

for: vscode status: blocked theme: internal-architecture type: bug
Dominant language
Java
Stars
983
Forks
240
Avg merge
7d 1h
Merged PRs (30d)
7

Description

The extension for the jdt language server that handles classpath-related messages is sometimes not notifying the classpath listeners, resulting in the Spring Boot language server not being able to do anything (because it does not know anything about the projects).

I observed this when working with the remote development extension in VSCode and Codespaces as well as local dev containers running on Docker. It doesn't happen always, but on a recurring base and definitely more often than when running VSCode locally with a local workspace. I have no idea what is causing this though.

Here is what I observed so far. In case it doesn't work, the Java Language server shows these messages appearing:

[Trace - 11:23:11 PM] Sending request 'workspace/executeCommand - (8)'.
Params: {
    "command": "sts.java.addClasspathListener",
    "arguments": [
        "sts4.classpath.ZXfryHYO"
    ]
}

So it looks like the classpath listener registration happens. If the mechanism works, a message like this is following to send classpath information from the Java language server to the listener:

[Trace - 11:23:12 PM] Received request 'workspace/executeClientCommand - (2)'.
Params: {
    "command": "sts4.classpath.ZXfryHYO",
    "arguments": [
        "file:/Users/mlippert/workspace/projects/spring-petclinic",
        "spring-petclinic",
        false,
        {
            "entries": [

However, in some cases this message doesn't show up. There is also no Job for sending the classpath information showing when (when looking at the Java Build Status output in the terminal that shows all the jobs running. The classpath sending job shows up there in case this works.

I tried this sample project:
https://github.com/spring-projects/spring-petclinic

If you clone this and open VSCode, everything usually works as expected. It also contains a devcontainer specification, so in case you have the Remote Development extension installed, it will ask you whether to open this project in a local dev container or not. If you agree to that and open the project in a local dev container (you need to have Docker running on your machine for that), the problem shows up - at least sometimes.

We need to investigate and fix this, it is a major blocker for people using the Spring Tools in a remote development scenario.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with spring-petclinic in a VS Code dev container using Docker, and compare the classpath listener registration request with the expected executeClientCommand response. Inspect the classpath listener path and the Java Build Status output, then verify that registered listeners consistently receive classpath information and the Spring Boot language server can use the project data.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, vscode
Domain
developer-experience, devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.