VScode and OH2.4 M6

So to summarize what i tried before:

  • different versions of VSC
  • clean installation of OH2
  • clean conf folder
  • changing ports and LSP settings
  • playing around with java versions

nothing works so far!

So, you are running VS Code and openHAB on the same Windows box?

Can you put LSP into TRACE mode, and post the log from the point when you start VS Code to the point when you create the rules file that causes the error?

log:set TRACE org.eclipse.smarthome.model.lsp

Can you test the latest snapshot version of OH if the error is the same.

Here you go:

2018-11-26 16:31:11.165 [DEBUG] [thome.model.lsp.internal.ModelServer] - Going to wait for a client to connect
2018-11-26 16:31:11.171 [DEBUG] [thome.model.lsp.internal.ModelServer] - Client /127.0.0.1:62705 connected
2018-11-26 16:31:11.181 [TRACE] [el.lsp.internal.MappingUriExtensions] - Going to map path file:///C:/DDRIVE~1/Openhab/OpenHAB2/conf

2018-11-26 16:31:11.182 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapped path file:///c:/D Drive/Openhab/OpenHAB2/conf to file:///C:/DDRIVE~1/Openhab/OpenHAB2/conf/

It looks fine for me, but still same error.

I doubt it is related to the extension somehow but im puzzled why!! and why now after the upgrade!! and why only me :slight_smile: !!

This i want to do as well, will try this also this week, if no more suggestions or ideas from anyone :frowning:

Maybe not. If you have any files in items/rules/things/persistence/sitemaps, you should also be seeing lines like these.

2018-11-26 13:06:09.510 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/sitemaps/default.sitemap to client path file:///opt/openhab2/conf/sitemaps/default.sitemap
2018-11-26 13:06:09.512 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/sitemaps/test.sitemap to client path file:///opt/openhab2/conf/sitemaps/test.sitemap
2018-11-26 13:06:09.610 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/rules/test-lsp.rules to client path file:///opt/openhab2/conf/rules/test-lsp.rules
2018-11-26 13:06:09.650 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/rules/test.rules to client path file:///opt/openhab2/conf/rules/test.rules
2018-11-26 13:06:09.651 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/rules/button.rules to client path file:///opt/openhab2/conf/rules/button.rules
2018-11-26 13:06:09.669 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapping server path file:///opt/openhab2/conf/rules/notification.rules to client path file:///opt/openhab2/conf/rules/notification.rules

I made an LSP change to fix a problem with samba shares, which was introduced with the xtext/lsp upgrade. In addition to testing the fix fixing using samba shares, it also worked fine in my test with VS Code and openHAB on the same host. But I tested with Linux, not with Windows. I wonder if thereā€™s something about the Windows platform thatā€™s causing the extension an issue.

@kubawolanin WDYT?

@Mohamed_Negm Do you have the ability to try it with VS Code running on a separate host from openHAB (doesnā€™t matter if the client side is Windows, Mac, or Linux) accessing the conf directory over a samba share? If that works, it could provide an additional clue.

I can reproduce the same error message in my environment with

  • openHAB 2.4.0 #1443 on Raspi with Zulu Java
  • VSCode 1.29.1

The error message disappears if the lsp is explicitly disabled in settings.json. With enabled lsp VSCode shows the ā€œInternal errorā€ message.

There is a log file entry in vscode-languagetool-languageserver.log with the following message:

Nov 26, 2018 7:09:22 PM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint notify
INFORMATION: Unsupported notification method: $/setTraceNotification
ERROR: de is not a recognized language.  Checking disabled.

Maybe the problem only occurs on non-english systems. I have no clue why ā€œdeā€ is used. VSCode ist running on a german Windows but language is set to english and also on my Rapi. The language is set to ā€œenā€.

EDIT: I was on the wrong track :frowning: This message was caused by different VSCode extension that also uses lsp4j.

Good find! That may more likely be the issue than what I posted above.

Unfortunately not :-(. This message was caused by an other extension (ā€œLanguage Toolā€) that also uses the LSP.

But this is now the callstack of the internal error caused by the openHAB extension:

Hello Mark,

I have tried from another windows machine on the same network, while sharing the conf folder via SAMBA shareā€¦ it works like a charm.

I even tried again with another linux machine, and it works!!.

It looks like the fix you added somehow affected the normal operation when they are working on the same machine.

Slight correction. It appears to be only when both are running on the same Windows box. Itā€™s fine when theyā€™re both on Linux. And, Iā€™m assuming, since Mac is more like Linux than Windows, that itā€™s ok with both on Linux. I think weā€™re going to need @kubawolanin to help us understand the reason for the failure.

1 Like

One other considerationā€¦ It could be related to my fix, or it could be related to the upgrade to xtext/lsp. While the former is more likely, I wouldnā€™t want to rule out the latter.

I always knew i would regret using Windows for OpenHAB :smiley:

For the time being, as a workaround, iā€™m using VSC on the same machine but refering to the SAMBA share i created instead of directly to the local folderā€¦This way it works fine :slight_smile:

Many thanks for all you guys and thanks in advance for your help and fix :slight_smile:

2 Likes

The ā€œInternal errorā€ is caused by an exception in the LSP resp. XText. If a drive letter is assigned to the network (SMB) path it works.

See also this issue: https://github.com/eclipse/smarthome/issues/6611

1 Like

Hi Guys,

Sorry for re-visiting this topic, i have upgraded to the latest milestone release (2.5M2) and iā€™m running OpenHAB in docker with host network over a linux machine and sharing the config files over SMB.

Iā€™m running VSCode in a windows machine on the same network and currently i donā€™t get any errors whatsoever and the only log i receive when i start VSCode is:

2019-09-09 07:56:23.839 [DEBUG] [thome.model.lsp.internal.ModelServer] - Going to wait for a client to connect
2019-09-09 07:56:23.839 [DEBUG] [thome.model.lsp.internal.ModelServer] - Client /192.168.0.133:49481 connected

While no errors are there, the LSP is not working as i donā€™t get any code auto-completion or error notifications.

Any idea what is missing here?