VS Studio Code - OpenHab Extension setup issues

Hi! (already posted under beginners but realized that this may be a more appropriate location)

I’m pretty new on this: running OpenHab 2.2 on RaspPI with manual installation, and trying to use VS Code Studio to edit the config files. Running VSCS 1.19.2 , OpenHab extension 0.3.5 on W10.
I have shared the folder “/etc/openhab2” on the RaspPI and opened the folder in VSCS, and modified the "User Setting openhab.host to the corret IP address (192.186.X.X).

If I create a new OpenHab file within VSCS the intellisense works as expected, all items etc. that I have setup within PaperUI comes up, so I assume that the REST API connection works as intended. However, what I do not get within the VSCS is the Tree view of my items (hence no code snippets etc.), and I don’t see the “openhab” button to load preview of the sitemaps etc.

As I’m pretty new to all of this I don’t fully know what to expect, and have only seen how it “should work” from online demo videos and images. I am suspecting that path for the config files is incorrect and therefore the Openhab Extension does not “kick in”, but I could be completely wrong…

Any help or direction to where I should read to get a better understanding would be very helpful. I have tried to get this to work for several evenings but only made tiny progress…

Not sure if it matters, but I also notice that if I set the Language Mode within VSCS to Openhab, save and restart, it’s changed back to plain text again.

Did you install the openHAB extension?

What folder are you opening?

I installed the openhab extension within VSCS and the path shared/used is /etc/openhab2 on the rasp pi

@kubawolanin, any ideas? The behavior seems odd. Everything seems to work with VSCode when creating a new file but opening the conf folder it treats it as just plain text.

Its more than that. It seems to me that the extension does not kick in, and I dont get the tree view of things/items/sitemaps etc. Either

The extension doesn’t scan the folder structure to determine file type.
It simply expects your file name to contain an extension like [items|rules|persist|things|sitemap] etc.
Make sure your files are named properly.

Tree View extension is also working that way - if it finds *.rules file, it’ll display a list of them there.

Let me know how this works for you :slight_smile:

1 Like

Thank you so much for your time and response. I was not aware that tree view was an additional extension.

What turned out be my fault and the solution, was that I was trying with the sample *.items, *.rules that was in the Openhab folder structure from before. When I created a new file myself, then the extension “kicked in” and things now seems to work as expected. (I have created new files before but then something else have probably been incorrect)

Again, thank you so much!

1 Like