openhab / openhab-vscode

VS Code extension for openHAB configuration files
https://marketplace.visualstudio.com/items?itemName=openhab.openhab
Eclipse Public License 2.0
159 stars 47 forks source link

VSC generic error messages #274

Open mstormi opened 3 years ago

mstormi commented 3 years ago

latest VSC (1.0) used with DSL rules

I quite often get error messages like the one below, repeatedly. LSP seems to stop working then (I gthink it recovers after some time but not sure). That one was right after starting VSC then hovering above a DSL item (making LSP retrieve it, but LSP was busy), but it also happens after VSC has been up in a while. I have NO idea what to look after.

openHAB vscode extension has been activated
[Error - 10:24:52] Request textDocument/definition failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.ClassCastException: class org.eclipse.xtext.common.types.access.TypeResource cannot be cast to class org.eclipse.xtext.resource.XtextResource (org.eclipse.xtext.common.types.access.TypeResource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @aff928; org.eclipse.xtext.resource.XtextResource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @595d55)
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
    at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
    at org.eclipse.xtext.ide.server.concurrent.AbstractRequest.logAndCompleteExceptionally(AbstractRequest.java:73)
    at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:69)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: class org.eclipse.xtext.common.types.access.TypeResource cannot be cast to class org.eclipse.xtext.resource.XtextResource (org.eclipse.xtext.common.types.access.TypeResource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @aff928; org.eclipse.xtext.resource.XtextResource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @595d55)
    at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:436)
    at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:36)
    at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:332)
    at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:112)
    at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:99)
    at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$24(LanguageServerImpl.java:608)
    at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:438)
    at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:607)
    at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:595)
    at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$23(LanguageServerImpl.java:586)
    at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66)
    ... 5 more
Confectrician commented 3 years ago

I doubt that we can do much here on the extension side. Extension just opens a connection to the remote server which is implemented in openHAB core. Every error message is generated there and just shown in the extension.

I have seen those messages too and i am unsure myself where and how to look for the problems root. Also i am not involved in how the LSP is implemented. Maybe @wborn can bring some light in the dark. He fixed some issues for that part in the past.

wborn commented 3 years ago

I haven't had time to look into these warnings. Maybe I find that one day. These warnings aren't that critical to me as that one issue I fixed one day where nothing worked. :wink:

Confectrician commented 3 years ago

I have already tried to catch those errors in vscode and provide a more readable message, but that did not work as expected.

I think we can configure if and how often LSP server will try reconnecting after a failure, tough i am not sure about the best option to choose then.