Current Behaviour
Code Validation in VS Code does not work (errors are not marked or explained), when clicking on other code lines, I get the following error message in the "Output" ("Ausgabe") area in VS Code:
[Error - 23:25:47] Request textDocument/documentHighlight failed.
Message: Internal error, please look at the server's logs.
Code: -32603
[Error - 23:25:48] Request textDocument/hover failed.
Message: Internal error, please look at the server's logs.
Code: -32603
This happens even when creating e.g. a new rules file.
This is a follow-up to this discussion, in which another user reported the same problem.
My environment
VS Studio Code (running on Win7 PC):
Version 1.19.1
Commit 0759f77bb8d86658bc935a10a64f6182c5a1eeba
Datum 2017-12-19T09:46:23.884Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architektur x64
using openHAB VS Code Extension 0.3.5
connecting to a openhab-2.2.0 distribution running on Raspian Stretch on a Raspberry Pi 3
Log Details
When opening a file in VS Code
(there is nothing logged in the "Output" Section or so in VS Code )
By default, there is no output in the openhab.log related to the Language Server probably due to this change: filter out known exceptions from the log #606
After setting log4j2.logger.lsp4j.level = INFO in userdata/etc/org.ops4j.pax.logging.cfg there is the following output:
2017-12-28 23:05:07.667 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Notification threw an exception: {
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/new.rules",
"languageId": "openhab",
"version": 1,
"text": "rule \"rule name\"\r\nwhen\r\n Item BL_AZ changed\r\nthen\r\n logDebug(\"openhab\", \"message\")\r\nend\r\n"
}
}
}
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:53) ~[102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:126) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:165) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:136) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84) [102:org.eclipse.lsp4j.jsonrpc:0.2.1.v20170706-0855]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51) ~[?:?]
... 11 more
Caused by: java.lang.NullPointerException
at org.eclipse.xtext.ide.server.WorkspaceManager.getProjectManager(WorkspaceManager.java:173) ~[?:?]
at org.eclipse.xtext.ide.server.BuildManager.internalBuild(BuildManager.java:150) ~[?:?]
at org.eclipse.xtext.ide.server.BuildManager.doBuild(BuildManager.java:125) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doBuild(WorkspaceManager.java:153) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.didOpen(WorkspaceManager.java:202) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$didOpen$4(LanguageServerImpl.java:263) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.RequestManager.runWrite(RequestManager.java:71) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.didOpen(LanguageServerImpl.java:266) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51) ~[?:?]
... 11 more
Here is the payload sniffed on port 5007 using Wireshark:
Content-Length: 1275
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8888,"rootPath":"d:\\openHAB\\openhab-2.2.0-rpi2","rootUri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2","capabilities":{"workspace":{"applyEdit":true,"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true}},"hover":{"dynamicRegistration":true},"signatureHelp":{"dynamicRegistration":true},"definition":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true},"codeAction":{"dynamicRegistration":true},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true}}},"trace":"off"}}
Content-Length: 444
{"jsonrpc":"2.0","id":"0","result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true}}}
Content-Length: 52
{"jsonrpc":"2.0","method":"initialized","params":{}}
Content-Length: 101
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"openhabLSP":{}}}}
Content-Length: 330
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/new.rules","languageId":"openhab","version":1,"text":"rule \"rule name\"\r\nwhen\r\n Item BL_AZ changed\r\nthen\r\n logDebug(\"openhab\", \"message\")\r\nend\r\n"}}}
When clicking on code lines in VS Code:
(there is no log output in openhab.log)
VS Code shows:
[Error - 23:25:47] Request textDocument/documentHighlight failed.
Message: Internal error, please look at the server's logs.
Code: -32603
[Error - 23:25:48] Request textDocument/hover failed.
Message: Internal error, please look at the server's logs.
Code: -32603
network payload:
Content-Length: 216
{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/test.rules"},"position":{"line":157,"character":3}}}
Content-Length: 117
{"jsonrpc":"2.0","id":"1","error":{"code":-32603,"message":"Internal error, please look at the server\u0027s logs."}}
Content-Length: 228
{"jsonrpc":"2.0","id":2,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///d%3A/openHAB/openhab-2.2.0-rpi2/conf/rules/test.rules"},"position":{"line":157,"character":3}}}
Content-Length: 117
{"jsonrpc":"2.0","id":"2","error":{"code":-32603,"message":"Internal error, please look at the server\u0027s logs."}}