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.