VSCode IDE Development Review (for addons)

Just to be clear - I’m talking about addon development and not the rules/sitemaps/etc editor.

I’ve been using VSCode to develop the sony binding for over a year now and thought I’d write up a review for everyone. Please note that I’m not an langauge/tools bigot/enthusiast and like to try out different things all the time - so this should be fairly objective. Eclipse/Intellij both have their own advantages/disadvantes and I’ll try not to get bogged down into pointing those out…

Setup
Out of the box, VSCode comes with little features (even more sparse than say Notepad++). To do anything meaningful, you need to install extensions - of which there is quite a few! To do java development in VSCode, you need to install the RedHat’s java extension (see openHAB IDE setup for more details) - which gives you a fairly comprehensive IDE for java. In addition to that, I’ve installed quite a few other very useful extensions (gitlens, tslint, vetur for Vue tooling [which sony uses], colorized brackets, better comments, etc). All in all, there was very few things I didn’t find as an extension for and have been fairly happy with the eventual setup.

Using it to develop the addon
Couldn’t have been simpler. I pointed at my sony directory in openhab-addons (which was originally created back in 2.1 days using eclipse) and it worked. Maven compiles done in the background, errors highlighted in the code, plenty of shortcuts to navigate with and many of the things you’d expect an IDE to have (peeks at code, finding references, etc).

Debugging
Simply have to start openHAB in debug mode (see the setup document again) and the IDE will connect to it and provide everything you expect of a debugger. Out of all the IDE debuggers I’ve used, I’d actually say this is one of the more powerful ones and absolutely one of the more easier ones to use. You can basically debug anything (atleast 200 different debugger extensions for every langauge/technology that I could see) and it’s multi thread window is extremely easy to use.

Pros
Simple IDE - the side bar navigation is simple and useful. Although it took some time to get use to, the way you execute IDE commands (CTRL-SHIFT-P - the “Command Palette”) is really powerful and easy to use. Just is a breeze to use.
Speed - perhaps the best part is that it’s unbelievably quick. Takes about 5 seconds from startup to be useful. I never once found it pausing or behind on keystrokes and I really don’t know how they have implemented a file search so quickly. Shuts down immediately, starts up almost as quick and can switch between screen modes (zen mode, full screen mode, etc) instantaneously. Really impressive.
Extensions - there are about a bazillion extensions that you can install to customize the IDE even more. I love the colorized brackets, gitlens provides a very good git manager, etc. Finding and installing extensions are managed within VSCode - so easy to find.
File type editing - I also love how the ‘context’ of the IDE switches based on your focused file type. In the sony plugin - I have java, typescript, vue, xml, json, etc. The IDE context switches as I’m editing each one - providing me the right tools/shortcuts/etc as needed.
Just works - the thing I love most is that it just works. No messing around with projects or complicated UIs. It’s simple, straightforward and works

Cons
Basic Editor - there are two things that are my biggest complain here. There is no overwrite mode - really? There’s an extension for that but it has some bugs in it and isn’t worth using. The biggest complaint is I can’t tear windows off onto my other monitors. It’s a single window IDE - very limiting. Both of these have open issues and are voted high (detachable windows is most voted issue) - but not implemented yet.
Nullable - RedHat’s extension doesn’t handle eclipse’s nullable annotation. You still get them when you compile - but you won’t know during coding and they won’t be highlighted on the screen.
Speed - not so much VSCode but RedHat’s java extension. When you save a file, it executes some type of maven compile in the background (not a full one but some incremental one) and some of the RedHat tools will stop working until that completes (for the sony plugin this usually takes about 7-10 seconds). The most annoying tool that stop working are references - you can’t pull up a reference by name nor can you peek/drill into any reference until that background compile completes. Very annoying. You end up only saving when you need to.
Extensions - there are still a few things I’d like that aren’t there. Javadoc is a little weak (I’d like to see javadoc validation in the editor), if you move a class from one folder to a next - no refactoring happens. Other than those - they cover what I use.

Summary
In summary, it’s a very capable IDE. Still shows a bit of immaturity compared to Eclipse/Intellij but is catching up quite quickly (has a monthly release schedule right now). Would I go back to Eclipse/Intellij - for addon development probably not. Provides everything I basically need and does it quickly - there are annoyances but they aren’t that huge (although no detachable windows is pretty close).

4 Likes