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.
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ā¦
@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
[191]
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.
Updated
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.
@chrisjohnson
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
@David_Graeff
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.
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.
Thanks,
David
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ā¦
Tim
Tim