VS Code openHAB Extension!

syntax
ide
vscode
Tags: #<Tag:0x00007f0e9b60b188> #<Tag:0x00007f0e9b60ae68> #<Tag:0x00007f0e9b60ac88>

(Josar) #243

@picarsqu3 Are you on Windows 10?
I use openSSH build in windows.

https://blogs.msdn.microsoft.com/powershell/2017/12/15/using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709

If not maybe this helps.


(Arno Pernozzoli) #244

Hi,

VS Code seems to send a request to openHAB REST API every time a new character is entered into the editor. Syntax checks slows down to unusable. I’m running openhabianpi. Am I missing any configuration settings to make it faster?

Cheers
Arno


(Kuba Wolanin) #245

@pernozzoli it’s not a REST call, but a JSON RPC-based communication of LSP (Language Server Protocol) for syntax validation with your OH.
You can disable it with "openhab.lspEnabled": true (hit Ctrl + , for settings) but ultimately I’d look through the log files and see if there are any stack traces regarding lsp.

Cheers,
Kuba


(SiHui) #246

Thx, would be great, I’m seeing

this too (RPi 3, openHAB snapshot #1268)


(c) #247

The MSDN URL worked for me, thank you!


(Chris) #248

My VSCode autocompletion / error checking is slow as hell as well. It rhymes, but its a pain.
For non-believers I have created a very short video in terrible quality (to reduce upload size and protect my precious “privacy”). Never mind the stuff I entered, its nonsense anyway, but what you can see is how painfully slow autosuggest works. The red “error” marker builds up letter by letter until it finally has “read” the entire word and then shows the autosuggest dropdown. Error handling thus is also painfully slow. openhab.log looks unsuspicious.
The upload will be available for 30 days / thus mid June.


(Holger OpenhabUser) #249

Same for me, the red error marker is creaping character by character…


(SiHui) #250

I just realized there is not even an issue for it, so I opened one:


(SiHui) #251

Issue got closed, similar issue exists already in the ESH tracker, added the slow autocompletion issue over there:


(Holger OpenhabUser) #252

Ha, thats interresting. I do not see any 100% CPU load, but I can see the CPU load on the raspi R3 goining up from 5% to 30…40% while I edit a rule file and the syntax check is checking a single character every 2 seconds. After checking finished it drops back to the normal value.
I run samba share on the raspi, VScode runs on a Core i5 with Win10, CPU load around 10…15%, so this can’t be the issue.


(Moxified) #253

Yeah, that’s my issue. Haven’t gotten much love. I long ago disabled the LSP as it renders editing impossible. I don’t make changes to my system all that often so it hasn’t been a big issue but is super annoying when I do make changes.

@HolgerL, is that 30-40% total or of a single core? I saw similar where the CPU on my debian server would jump to 100% of a single core while it was catching up and then would drop back off to normal low levels. I’m using an i7 macbook as my VSCode machine.


(Holger OpenhabUser) #254

That 30-40% is the CPU load of the RPi3 running Openhabian and samba share! The value is reported by the CPU Binding. It is not the CPU load of the PC running VSCode! This is low.


(Aaron) #255

Is there an alternative to vs code for android so I could develop my rules ect while out and about


(Michael Cumming) #256

I am seeing the same issue - were you able to solve it?

Mike


(Peter Ooms) #257

Hi, I just started via VSC & got the same (file not found while trying to peek for definition). Below my circumvention that works (for me).

What I’ve done is to create a local symbolic link for the “inaccessible” prime-directory which (now) redirects to the SMB mounted NAS path.

My openHAB configuration is stored and executes on a NAS location and I edit remotely via SMB access.
The openHAB config is physically store don the NAS in /share/openHAB/conf , I access/edit this through SMB //qnapsrv/rdisk that is locally mounted as/in /media/Rdisk . So flat editing are done via /media/Rdisk/openHAB/conf…"

For VSC, which couldn’t find “/share/…” , I’ve added a symbolic link “ln -s /share/ /media/Rdisk” which effectively will redirect the primary (not found) directory, to & by the accessible target location. Things are now working smoothly…

Note: to prevent all kinds of generic UNC path problems etc.etc., I access my remote SMB files via explicit cifs mounts.

In your case the openHAB is remotely stored in directly “/etc/openHAB”, you could create a local symbolic link “openHAB/” in your local “/etc” directory that will redirect to the SMB/cifs mounted //server/bla/bla/etc/openHAB location


(Ramz) #258

er, I’ve read through this and not really sure where everyone landed :slight_smile:

Q1. the insert into sitemap issue - is it still a problem?
Q2. and the ‘go to definition eg. Unable to open ‘test.sitemap’: File not found (file:///etc/openhab2/sitemaps/test.sitemap)’ issue - still a problem?

like many others, my openhab2 is running on a rpi, openhabian 2.latest stable
VSCode on Win 7 (but also on a Mac as I figure out which one I become loyal to)
have the ip and port in user settings - the rest are defaults.

in workspace settings I have “path”: “\\192.168.2.31\openHAB-conf” but I see some others have smb://ip/openHAB-conf - Q3. does this matter?

I might go the symlink way of @PtrO but obviously I want to avoid that if possible.

Q4. if the issues still exist is anyone working on fixing it anytime soon. Not pushing anyone who has other stuff in life to do just would help me plan to wait and make do for now vs the symlink exploration and effort.

thanks in advance!

update: I did find ‘answers’ to 2 other related VSCode/Openhab questions, although it seems the culprit is LSP and not VSCode

Q5. why does my rpi CPU spike when using VScode and LSP functionality?
Q6. why do I get error messages in VScode output window asking to check server logs

A. https://github.com/eclipse/smarthome/issues?utf8=✓&q=is%3Aissue+is%3Aopen+lsp

hopefully this will help someone who stumbles across this thread. I’d still love some help with Qs 1-4 though please.


(Jerome) #259

Hey @r4m235

I can’t answer all questions now directly.
There are already some fixes in the pipeline and some new features have been added.
I have talked to @kubawolanin some days ago and we want to push a new release in the nearer future.
Can’t tell you any dates since kuba seems to be very busy those days and my time is limited too.

Unfortunately we can’t do much about the LSP Stuff.
Someone has to grab the smarthome issues, but LSP is a rare topic.

I think this depends on the system and how you have opened the folder in vscode.
The path workspace setting could be handled by vscode itself.


(Ramz) #260

I’m not sure how useful that is due to the lack of specifics and the broadness of ‘sometime in the future’ BUT it was getting very lonely here so I do appreciate the response and I’ll keep my eyes out for any updates. Thank you


(Jerome) #261

Yeah it was quiet for a longer time. :smiley:
You are totally right.

If there are only a few people contributing and those have limited time capacities, it gets quiet very fast.
But i want to get a new release very fast, because it will include a bugfix for the several rest api issues.

Can you point me to the sitemap insert issue?
The thread is very grwon and i can’t remember everything^^
Maybe it is clarified already.


(Ramz) #262

right, since this is voluntary we can’t expect more than is given.

here is the issue: https://github.com/openhab/openhab-vscode/issues/63

right at the end kubo offers a fix and a zip file but even recently with the extension downloaded through VScode the problem exists. I must admit somehow I skipped seeing that zip and will give it a go in a few days (vacation) and update my initial post with the outcome.