Empty responses sent by Java Language Server on almost all actions like autocomplete, definition inspection caused by Apache Flink archetype
See original GitHub issueAll code completion, suggestions, definition inspections, etc. are not working because the Java Language Server is returning an empty response on all requests. Important to note is that I’m using VS Code Remote with WSL.
I’m not sure if the problem lies in the extension or the LS. If it becomes obvious that the problem is in the server, I will create a ticket in that repository.
Environment
- Operating System: Windows 10 (1903) in combination with WSL 1.0 Ubuntu 18.04.3
- JDK version: 11.0.5 (installed in WSL)
- Visual Studio Code version: 1.41.1
- Java extension version: 0.8.1
Steps To Reproduce
- Create a simple Java file in WSL
- Open VS Code with the remote extension connected to WSL
- Open the Java file in VS Code remote
- Begin typing any Java code, or hover over any existing Java code
Current Result
In the case of autocompletion, no suggestions in the context of Java code is given. In the case of definition dialogs, these are not even shown. There is no response from VS Code whatsoever.
Expected Result
Autocompletion fields with Java related code is shown; information dialogs when hovering over existing classes is presented. Just generally everything that is shown in the Features GIF in the README.
Additional Informations
The Java Runtime is set to the JDK_HOME
path as set in WSL, and it looks like the extension can find and use the runtime.
The (simple) Java project that I’m using for this ticket is the Apache Flink tutorial project (which can be found here). When using the completed code as a reference, one would assume that hovering over simple stuff like StreamExecutionEnvironment
would show a definition. Or on a newline start typing Math.
would show an autocomplete field with Math
methods. However, nothing is shown. When I turn on message tracing between the extension and the LS, I can see that requests are made for every action, but on almost all actions the server returns an empty response.
For example, here is a snippet of several actions:
[Trace - 3:54:12 PM] Sending request 'java/findLinks - (38)'.
Params: {
"type": "superImplementation",
"position": {
"textDocument": {
"uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
},
"position": {
"line": 10,
"character": 27
}
}
}
[Trace - 3:54:12 PM] Received response 'java/findLinks - (38)' in 4ms.
Result: []
[Trace - 3:54:12 PM] Sending request 'textDocument/documentHighlight - (39)'.
Params: {
"textDocument": {
"uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
},
"position": {
"line": 10,
"character": 28
}
}
[Trace - 3:54:12 PM] Received response 'textDocument/documentHighlight - (39)' in 3ms.
Result: []
[Trace - 3:54:12 PM] Sending request 'textDocument/codeAction - (40)'.
Params: {
"textDocument": {
"uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
},
"range": {
"start": {
"line": 10,
"character": 28
},
"end": {
"line": 10,
"character": 28
}
},
"context": {
"diagnostics": []
}
}
[Trace - 3:54:12 PM] Received response 'textDocument/codeAction - (40)' in 3ms.
Result: []
[Trace - 4:06:35 PM] Sending request 'textDocument/codeAction - (41)'.
Params: {
"textDocument": {
"uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
},
"range": {
"start": {
"line": 16,
"character": 24
},
"end": {
"line": 16,
"character": 24
}
},
"context": {
"diagnostics": []
}
}
[Trace - 4:06:35 PM] Received response 'textDocument/codeAction - (41)' in 4ms.
Result: []
[Trace - 4:11:10 PM] Sending request 'textDocument/codeAction - (42)'.
Params: {
"textDocument": {
"uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
},
"range": {
"start": {
"line": 6,
"character": 61
},
"end": {
"line": 6,
"character": 61
}
},
"context": {
"diagnostics": []
}
}
[Trace - 4:11:10 PM] Received response 'textDocument/codeAction - (42)' in 5ms.
Result: []
Edit: I should note that I’ve also tried cleaning the LS workspace directory. Unfortunately, this did not solve my problems.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
After creating a project from the com.alibaba.blink:flink-quickstart-java:1.5.1 archetype, I managed to reproduce the problem. Whoever created that archetype misunderstands how Maven support works in Eclipse and added some configuration that actually breaks Java support in both Eclipse and vscode-java.
Please remove this snippet from the pom.xml:
@fbricon Removing the snippet works, indeed! The same solution works for the Apache archetype (as Alibaba forked it from Apache). I’ll open an issue in their repository to discuss whether this is something they want to solve (or mention in the docs).
Thanks for your time!