VSCode doesn't validate my code


(Pascal Turbo) #1

Hi There,

I’ve setup vscode for usage with openhab but it doesn’t work at all. When writing false code, there is no highlighting. And I can’t find any further information about it. Any idea how to debug this?

Bests
Pascal


(SiHui) #2

It does not “highlight” the rules text, you need to activate the “problems” tab.


(Mark) #3

Speaking of this, when did the behavior change? At one point, and I don’t remember exactly when, I seem to recall that it highlighted the broken bit of code. And, if you moused over the broken code, it displayed the error. Am I remembering this right? :confused:


(SiHui) #4

Wasn’t that only the case for the Eclipse Smarthome Designer?


(Mark) #5

I dunno. I never really used Designer.

I’ve been using VSCode for a long time, and I don’t remember needing to use the Problems tab to see the errors until very recently.


(SiHui) #6

Strange … I have never seen any highlighting outside the problems tab :sunglasses:


(Mark) #7

I have. :sunglasses:

vsc

This was from build 1250.


(Mark) #8

And this is from build 1405.

vsc-broken

I dunno if removing this functionality was intentional or not…

@Kai Can you clarify whether this change was intentional?


(Pascal Turbo) #9
  • Even the problems tag stays empty
  • @mhilbush: Which tool do you use for creating this cool video / animations

(Kai Kreuzer) #10

I am not aware of any intentional changes, no. The only change wrt LSP was the Xtext upgrade that was done 1-2 months ago. Maybe this broke something in this regard?


(Kai Kreuzer) #11

I’ve just quickly tested it on 2.4.0.M5 and VS Code 1.28.2 and it all works as expected:


(Mark) #12

Hmm. I’m on build 1405 and VS Code 1.28.2. I wonder why it’s not working for me. I’ll continue to investigate. Thanks for checking.


(Mark) #13

GIPHY CAPTURE on my Mac.


(Mark) #14

@sihui It sounds like you’re seeing the same behavior as me (i.e. no inline display of problems as you type). What’s your config?

Could you clarify a couple more things about your config?

  • Are you running 0.4.0 of the openHAB VS Code extension?
  • Are you running VS Code on the same host as openHAB?

(SiHui) #15
{
    "openhab.host": "192.168.2.237",
    "openhab.port": 8080
}

openHAB Snapshot #1380 manual install in /opt/openhab2 on a RPi 3
VSC 1.28.2
openHAB VS Code Extension 0.4.0

Edit:

test

test1


(Mark) #16

I installed VS Code and the openHAb extension on the same Ubuntu 16.04 box that’s running openHAB build 1404. The inline error highlighting works!

So, the issue appears to be where VS Code is running on a separate box (both Windows and Mac in my case), which is accessing the openHAB conf directory via a share.

We can confirm…
@sihui Are you running VS Code on a separate host than openHAB?
@kai Are you running VS Code on the same host as openHAB?

@Kai Do you consider this a regression? Possibly related to the xtext upgrade, as that appears to be the primary difference relating to LSP?


(SiHui) #17

Yes, Windows 10.


(Pascal Turbo) #18

It’s running away from my question :smiley:

  • I’m running OH on a remote host
  • I’m not accessing config folder via share - I’m working with a local git repository
  • The problem occurs on 2 different Macs running the newest vscode and openHAB Plugin.
  • I don’t see any information - neither inline, nor in the problems tab.

Here’s my config:

"openhab.host": "192.168.0.100",
"openhab.port": 8080

(Mark) #19

Sorry about that. :wink:

I’m not familiar with that type of config with respect to VS Code and openHAB.

LSP is installed and active, right?

openhab> list -s | grep lsp
 94 │ Active   │  80 │ 0.4.1.v20180515-1321   │ org.eclipse.lsp4j
 95 │ Active   │  80 │ 0.4.1.v20180515-1321   │ org.eclipse.lsp4j.jsonrpc
131 │ Active   │  80 │ 0.10.0.201810290804    │ org.eclipse.smarthome.model.lsp

Did you try adding this to your vscode config?

	"openhab.lspEnabled": true,
	"openhab.lspPort": 5007,

(Pascal Turbo) #20

lsp is installed and active - checked via netstat. There’s a service listening on 5007

I’ve set the two options on my notebook - nothing changed.