Open mfortunat opened 6 days ago
Do you know how to reproduce it? Have you a sample project?
Could you enable the LSP console trace https://github.com/redhat-developer/lsp4ij/blob/main/docs/UserGuide.md#lsp-console and share the LSP trace when this error occurs.
I attached the log file. FYI, it generates a new error for each and every cursor move in the code editor; regardless I use the cursor keys or the mouse.
Do you have the latest versions of LSP4IJ and Quarkus Tools?
LSP4IJ 0.5.0 Quarkus Tools 2.0.2
Thanks for the log. The error is very strange, it should send some request like
Here a sample of error:
[Trace - 17:45:56] Sending request 'textDocument/codeAction - (44)'.
Params: {
"textDocument": {
"uri": "file:///Users/massimo/Dropbox/Projects/Upwork/Lightwell/McLane/repos/mclanemodern-order-collection-mw/commons/src/main/java/com/mclaneco/oms/commons/exceptions/ModuleAwareException.java"
},
"range": {
"start": {
"line": 54,
"character": 49
},
"end": {
"line": 54,
"character": 49
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}
[Trace - 17:45:56] Received response 'textDocument/codeAction - (44)' in 1ms.
No result returned.
Error: {
"code": -32603,
"message": "Internal error.",
"data": "java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)\n\tat org.eclipse.lsp4mp.ls.commons.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:148)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\nCaused by: java.lang.reflect.InvocationTargetException\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:115)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:580)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)\n\t... 12 more\nCaused by: java.lang.NullPointerException: Cannot invoke \"org.eclipse.lsp4mp.ls.java.JavaTextDocuments$JavaTextDocument.executeIfInMicroProfileProject(java.util.function.BiFunction, Object)\" because \"document\" is null\n\tat org.eclipse.lsp4mp.ls.java.JavaFileTextDocumentService.codeAction(JavaFileTextDocumentService.java:225)\n\tat org.eclipse.lsp4mp.ls.MicroProfileTextDocumentService.codeAction(MicroProfileTextDocumentService.java:220)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\n\t... 14 more\n"
}
This error is very strange because it should send:
[Trace - 19:32:17] Received request 'microprofile/java/codeAction - (10)'
but it seems it crashes?
Is there any chance that you share your project?
No, sorry. It's not a personal project. What I can tell you is that is a multimodule maven project based on Quarkus 3.10.0, with Apache Camel, and with Kafka and MongoDB Camel components.
I don't remember all of these issues with LSF4IJ 0.4.0
It is very hard for me to understand the problem since I cannot reproduce it -(
If you can find another relelvant logs, please attach it.
After investigating again your LSP trace, the error comes from the MicroProfile LS at https://github.com/eclipse/lsp4mp/blob/46bdf69f725349371c401066f85f2034a6fbec2f/microprofile.ls/org.eclipse.lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/ls/java/JavaFileTextDocumentService.java#L225
It seems document
which is the opened Java file is null? I can fix that on MP LS side, but I don't understand how to you can have this usecase.
According your LSP traces you close several files and after that you reopen them. I wonder if you are using a menu contextual or another thing to reopen them in same time?
I wasn't opening or closing documents at all. I had a set of open Java files, one or two properties files and a pom file. Simply moving the cursor generated a new error at each keypress or mouse click.
The very long log file I attached was produced in just a bunch of seconds.
Before having your issue, you have closed serveral files and open theJava file which causes the problemand after that you were in a bad state. I don't know why. I need to understand how to reproduce this usecase.
Can you reproduce everytime?
No, I generally close IJ when I end working with it and restart the following day with the same open files. When I close/open files in general is 2 or 3 of them, never 20 or 30 or more.
Yesterday I rerun IJ several times, and every time it was producing the errors. It's about 3 hrs it is up today, and I haven't had a single issue (so far and keeping fingers crossed).
BTW, I haven't installed/upgraded anything at OS level
Error while consuming 'textDocument/codeAction' with language server 'Tools for MicroProfile'
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193) at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$1(LanguageServerWrapper.java:260) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
IntelliJ IDEA 2024.2.1 (Ultimate Edition) Build #IU-242.21829.142, built on August 28, 2024
Additional info:
It has already occurred 46 times in the last 2 or 3 days. Very annoying