VSCode Guide

Documention/guide is now online at https://www.openhab.org/docs/developer/ide/vscode.html


We have a docs page for the development area which includes ide setups and a vscode setup guide is on the todo/needed list, so this is a perfect start for completing that step. :slight_smile:

Thanks - I figured people will probably find whatever errors I have on this. Once it seems stable - I’ll put in a PR on that to include the info…

1 Like

@Confectrician I have the following in mind for that section:

  • remove the eclipse step by step part and put it on its own page.
  • Have the 3 images of the ide’s as clickable large image links in one row. Each link directing to the respective step by step guide. I guess that vuepress allows html tables in markdown.

Regarding this detailed step by step guide:
The eclipse develop guide is also version 0.1, so I’d say if you agree we add this to the page already. More people will see it and we’d get more feedback faster.

I will verify on Linux and amend the page on demand and try to get my hands dirty with Intelli.


I have also thought about a separated ide page. The index gets really huge with those informations.

Just let me know if I can be of any more help or if you want me to PR anything. In the mean time, looks like I’ll start converting my sony addon to the new system

I guess we can change our Vscode extension to create the tasks and launch file for us in the future.

Imagine that developer flow:

  • Install openhab. Click “enable debug session” on a paper UI successor.
  • Install Vscode and the openhab extension.
  • Click on a menu -> Create new binding or > Import existing binding.

That would be super slick. I mean apart from the maven errors that we’ll get here and there.


Yeah - that would be really nice. Beyond my pay grade though!

Thanks a lot for these instructions!

I ran through them and everything was fairly self explanatory. Couple of small things:

“Save and close” i would say “Save and close tasks.json” i wondered if you mean close VS Code or just the file.

Leaving a terminal in ‘target’ directory (while doing step 3.c. to check the jar) meant that the build failed while trying to clean the project.

With that said, i followed everything and saw my binding jar copied to the \addons folder, but even after waiting many mins and restarting openhab I still cant find my binding to add. Something im missing?

Thanks again for the instructions. VS Code is great.

Ok i see why its not loading.

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.somfymylink 
  Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

I’m pretty new to all this so excuse the n00b question, but my build using Eclipse didn’t have an issue. Is there something i need to tweak to make sure this reference is included somehow?

I got around this by dropping gson-2.8.0.jar in the \addons folder.

Should this be necessary? Sorry, not really understanding how dependencies are handled.


Assuming that’s a new binding (since I don’t see it in my tree) - you should reask that question in the main development/idebuild forum (not this thread) since it has to do with build rather than in the VSCode stuff. As to why, I personally don’t know since I haven’t used the new build system yet (and don’t know how dependencies are evaluated yet).

Ok thanks. I wasn’t sure if it was an issue due to this VS Code build/deploy vs. Eclipse as i didnt get the issue there. But i think its just a OH version difference that is causing it. Thanks again for the instructions … really happy you figured this out.

If you are using a plain vanilla instance of openHAB 2.5 (where you haven’t installed anything in yet). Dropping bundles into the addons will NOT install dependencies (don’t ask me why). You’ll need to either install some existing addon that uses gson (which will install the gson support) or install it yourself. Easiest way - go into the karaf console and do “bundle:list com.google.*” to see what has been installed

1 Like

One nice thing would be to have the same code formatting in VSCode (I know there’s another thread kinda discussing this). According to this https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings - we can use the eclipse formatting file if it’s available somewhere. I know nothing about the formatting and was hoping you might know if there is a file defining this somewhere on github (or elsewhere). If not, maybe we can have a global .settings/org.eclipse.jdt.core.prefs that shows the formats…

There is a (broken) link to this in the Developer Guide, but here’s the file…

Maybe we should separate the User part from the developer part and create a developer extension.

1 Like

The new intro page has been merged with an own page for VScode.

@tmrobert8 Can you issue a PR for adding your VScode instructions? That’d be sweet. Even more so if you could add some screenshots.


1 Like


Sure - I’m actually doing a bit more work on it (adding additional tasks [like doing a full compile, starting/stopping an openhab debug instance and making sure it works across platforms]). Once I’m done with those - I’ll run a PR through. Note: I like @Confectrician idea about making a developer extension (as I can see a few more interesting things that can be done) - might tackle that one eventually if there is some interest…