VScode and OH2.4 M6

Are you running an openhabian installation?

No, windows installation :frowning:

what is the exact error?
is it coming from VSC or OH2?

I have VSC 1.29.1 with openHAB VS Code Extension v0.4.0 and it works very good with OH2.4.0.M6

Sorry for the late reply, i was out of town for the weekend :slight_smile:

Actually the error is happening on VSC itself, (1.29. 1), once i start it it it shows the below image:

It doesn’t show any other details.

I tried several versions, but nothing works. I rolled-back to 2.3 stable version, and it worked perfectly.
But never with 2.4 M6

The only configs i have is:

everything is default.

I have the same error on M6 and I’m using openHab on RPi (openHabian with the included samba share if that matters). However this error shows up after starting VSC, but I can use it without problems…

can you post some additional log entries from VSC? (maybe under View->Debug or View->Problems)

I don’t know what could be the root cause.
anyway, it wouldn’t hurt to specify all parameters in your json:

{
    "openhab.username": "",
    "openhab.password": "",
    "openhab.port": 8080,
    "openhab.lspPort": 5007,
    "openhab.host": "localhost",
    "openhab.useRestApi": true,
    "openhab.lspEnabled": true,
    "openhab.restCompletions": true,
    "openhab.paperInBrowser": true
}

That is the weird part :). it is totally empty, no problems, no debug nothing!!! just the notification that there is internal error and that is all.

I did add all the config as per you recommendation, but same error appears :frowning:

it seems that there are issues with VSC and Java LSP addons. The VSC code extension hasn’t been updated in a while, so maybe there is something wrong when it tries to connect to 2.4.0.M6 LSP… not sure

I don’t have this problem on my Win machine connecting to a remote Linux box. I will try to reproduce this with a local OH2.4.M6 installation on Win.

I found something similar (not the same) here: https://github.com/georgewfraser/java-language-server/issues/45

btw: do you have the %JAVA_HOME% env variable correctly set?

It looks like maybe related, i have just upgraded java as well to 8.0.191 version with the same time frame of updating to M6.

But java home is set correctly.
image

1 Like

I cannot reproduce this :frowning:
I just installed OH2.4.0.M6 on my Win machine and I can work fine with VSC+M6…
check on how to debug this kind of error code in VSC

It looks like the extension itself is not starting properly as there are no logs watsoever, and there are not communications captured on wireshark as well.

Maybe @kubawolanin can shed some lights on this if he has time.

I removed VS code totally, deleted all related files and extensions folder.

Started a fresh installation.

The error didn’t appear at all except after i choosed the folder where the conf files are for OH2!!

What can cause this problem!

interesting… maybe some of your config files have problems (but this shouldn’t cause the VSC extension to explode…)

I would try to remove all the config files out of the conf/ subfolders, move one by one back to see which one causes the explosion :slight_smile:

You can keep your OH2 service down during this test.

Keep a backup of your configs by the way!

Ok, it is really weird and i don’t know what to do now…
i wiped all the conf files i have… started the system with no configs.
Started VS code, choosed the folder… Everything is ok.

Went to rules folder (in VS code), created a new file named it “test.rules” and BAAAM… internal error again!!

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?