openHAB VS Code Extension 0.3.5

I will submit a PR soon, a few other things to learn first.

@kubawolanin Ever thought of running VS Code in a browser, e.g. like
https://stackblitz.com/ ?

Very strange thing… Today i updatet my oh 2.2 to latest snapshot, now i can use rule syntax checking.

But i have lost to use tabs. Before the update, i was able to open many tabs with many rule-files, item-files and so on.

Now i only can open 1 *-file and when i click on the next file to open, it opens in the tab of the last opened file. So only one open file in the upper tab-bar.

Any idea what could be the problem?

The enable-tabs on workbench setting is “true” - i didn´t change anything on my configuration, except i made the snapshot update.

I have been so long. I did not look for solutions, just drag and drop the file into the workspace from the Explorer.

Thanks, this workaround is working.

The syntax checking is not very stable…

I often get error messages in the “Problems”-field and i have to restart VSCode to get rule checking back.

Please report any defects here.

But i have lost to use tabs. Before the update, i was able to open many tabs with many rule-files, item-files and so on.

@halloween, could you confirm that the tabs are broken because of the openHAB extension? Please deactivate the extension, reload window and test it again.

Also, please remember to share more details on your environment when you report bugs such as yours.
What’s the OS, what’s the VSCode version etc.

It’s an issue on the backend side, see issues here and provide more details, logs or +1s in the existing issues.

I only use vscode for openhab. If i move the items-files, rules-files and so on from left side (explorer-view) to the workbench, i can open all files in multiple tabs, only if i press the files on left side with the mouse-button (left or middle button) it only opens 1 single tab and every new items-file is opened in the same tab.

latest VSCode 1.18.1 on Win10 64bit Prof

Openhab 2.2 snapshot - latest build # 1138 from 15.12.2017 - running on debian server

openhab.log shows errors like this:

2017-12-15 07:49:22.853 [ERROR] [nrpc.json.ConcurrentMessageProcessor] - java.net.SocketException: Connection reset
java.lang.RuntimeException: java.net.SocketException: Connection reset
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:103) [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.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:210) ~[?:?]
	at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:?]
	at java.net.SocketInputStream.read(SocketInputStream.java:224) ~[?:?]
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:61) ~[?:?]
	... 6 more


and


2017-12-15 07:51:06.412 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Unmatched cancel notification for request id 1
2017-12-15 07:51:06.768 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Unmatched cancel notification for request id 2
2017-12-15 07:51:22.871 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Unmatched cancel notification for request id 10
2017-12-15 07:51:33.999 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Unmatched cancel notification for request id 14
2017-12-15 07:51:35.651 [WARN ] [eclipse.lsp4j.jsonrpc.RemoteEndpoint] - Unmatched cancel notification for request id 16

My point is that there’s no single line of code in my extension that would affect tabs management.
Thus, I need you to double check it before I go further with investigating that.
Please disable the extension and try reproducing the bug again.

Same behaviour with deactivated extension.

Looks like a duplicate of https://github.com/eclipse/smarthome/issues/4629

So it’s not my extension’s defect. Take a look at VSCode docs and see if it’s something conigurable. If it’s clearly a defect, report it here.

I think this is expected behavior in VSCode.

If opening a file, it will be loaded in a tab. Now, if loading the next file without changing anything, VSCode decides to load the new file in the same tab. But if you change something in the file, the Tab name changes from italics to normal and the tab gets ‘pinned’. Now the tab ins’t overloaded by a new opened file but instead a new tab is opened.

2 Likes

If you want, you can override this behavior by setting this in your vscode system defaults.

    "workbench.editor.enablePreview": false,
3 Likes

@kubawolanin Is there a way (in future releases) that clicking on an item inside of the code editor (i.e. while editing a *.rule file) to see it’s value?
Maybe by letting the item browser window automatically jump the the related entry, by showing a small hint or having it in the context menu somehow?
Right now the item browser is nice, but as there seems to be no search function it is partially very time consuming finding the related item.

@LarsK please submit an issue with your idea - I’ll see what I can do during the holiday break :wink:

Done :smiley:.
And many thanks in advance …

You can also double-click on a file in the explorer, the tab header in italics (or the file name in italics in the “open editors” pane) to “pin” it.

Hello all,

I’m new to OpenHAB so I apology in advance as my knowledge about the platform is very limited although I’ve been reading a lot. Today I just upgraded to latest openhabian release (2.2.0-1) because I wanted to give a try to the integration with Visual Code.
So I installed Visual Code as well, and the extension for OpenHab (release 0.3.5). I also changed the configuration file to point to my openhabian IP server.
As soon as I open Visual code, I receive the message “internal error, please look at the server’s logs”.

And this is where my nightmare starts :wink: This is what I’ve done so far:

  • If I change the parameter openhab.lspEnabled from true to false, the error message disappears
  • Syntax checking seems to work properly
  • Server is listening to port 5007 and it seems it’s connecting with my desktop computer (see attached file)
  • But if I try to check openhabian logs, there is no errors to trace this. Nothing, void

Can someone help me to work it out?

Thank you!!

LSP_log

PD: I’m about to give up cause although I have a minimal installation to get used to this environment (only 2 wifi led controllers), it’s not so uncommon to see some error messages in my var log during the starting process and it’s very time consuming to debug them as openhab is a big, very big project. On the other hand, I’m really engaged as I love this project but it’s taking a huge amount of time to get a grasp.
I would love to be knowledgeable about openHab!!!

I have exactly the same problem. I am using openhab-2.2.0 release and VS Code Extension 0.3.5.

The error messages described in the reply above openHAB VS Code Extension 0.3.5 come from the openhab server (easily to spot using wireshark listening to port 5007).

I am migrating from OpenHAB1 and was hoping to have VS Code check my (existing) rules file for errors, but I am not sure if it will do that even with LSP working? I was expecting an error highlighting similar to the Openhab/Smarthome Designer.