Top Stories

VS Code is an open source cross-platform platform for developing software developed by Microsoft, loosely based on Visual Studio. It’s cross-platform because it runs on Windows, Linux and Mac but it’s also a platform because you can host editors, compilers, linters, source code formatters, debuggers and tools for virtually any programming language in existence. Even better, if the language doesn’t exist you can write extensions to implement it etc. and that includes creating debuggers. It’s like Eclipse but on steroids and bloat free.

Getting Started

I have Visual Studio 2015 Community edition already so I was interested in seeing how VS Code would work on Windows. I’ve also got VS Code installed on Ubuntu (running under VirtualBox) and was quite taken with it. As it’s only a 33 MB download, installing the Windows version takes no time. By default it comes with built-in support for JavaScript, TypeScript and Node.js. If you want other languages, you have to install them but I’ll come to that later.

The user interface is simplicity itself with a top menu and just five icons down the left. These are Explorer for browsing files, Search, Source Control (with Git built in), Debug and Extensions. Extensions are how you add other stuff and VS Code is highly extensible. That’s an understatement but more on that later.

I decided to setup the Windows VS Code for Go development. On Linux I’d done it for Python and PHP. There’s a library of extensions and it’s easier searching it from a browser than in VS Code. There are currently 2,919 extensions in the VS Code marketplace and it’s increasing by 15-20 a day.

Searching for Go revealed 67 results though most are unrelated to Golang. I noticed that the Code Runner extension can run programs from C, C++, Java, JS, PHP, Python, Perl, Ruby, Go, Lua and many more assuming you have installed the languages you want to run.
Some languages have the compiler as part of the extension for instance The TCC (Tiny C) extension installs Tiny C so you can compile and run it, but many languages need the compiler preinstalled and configured and that includes Go.
If you want to debug Go you need the LukeHoban.Go extension and that supports all the Go Tools. It didn’t use Git built into VS Code so I had to manually install Git first to get all the Go Tools. It’s a minor glitch.
As I understand it, Git was only incorporated into VS Code in the 1.1 release. Before that it was an extension. Once Git was installed, then from the Bash command line, I ran the commands from this Github page to install all the tools. It includes a link to the Go source code debugger (Delve) and how to install it.
As the screenshot shows a Go program stopped at a breakpoint. Variables are shown on the left with the Call Stack below it and the output below the source listing. This uses the same Debug keys as in the full fat Visual Studio. F5 to run with debug, F10 to step over, F11 to step into etc. As Go source code is included F11 lets you step way down into the innards of the libraries.

Extensions

Extensions transform VS Code into the IDE you want. If the programming language of your dreams isn’t supported then you can write an extension for it and submit it to the marketplace. Examples are provided included one for creating a debugger. One I recommend is Bookmarks by Allessandro Fragnani. In theory the marketplace extensions can be paid for as well as free. In practice they’re all free.

In many cases, you need the programming language already installed and configured as I did with Go. If there are multiple implementations as I had with Python on Linux (there were five counting virtual environments), you can pick between them using the built in command palette that you activate with ctrl-shift + P.

Editing

VS Code has one of the more powerful editors and it’s themed, so you can make it look and feel as you want by editing a JSON file or by picking from one of the installed themes. If you need more then there are over 660 themes in the extension marketplace!
You have side by side tabs, multiple cursors, folding and lots more. There are key map extensions so if you prefer VIM, Emacs, NetBeans or Visual Studio Key maps you can easily install any of the 27 in the marketplace or use the built in keyboard short cuts editor. Macros aren’t built in but there’s an extension for that.
The command palette is a pull down list for all available commands with the shortcuts.
Lastly, VS Code is highly configurable, done by copying parts of a very large settings file with about 300 settings. Just scroll through the read-only settings file, copy the settings you want into a workspace or user setting file and change them.

Conclusion

VS Code is elegant and slick and looks the same on Linux as it does on Windows. With some programming languages, it can be a little fiddly to setup but way less than say Eclipse. The range of programming languages in the marketplace is just astonishing making this the IDE that beats all the rest on that one aspect alone. And it’s open source. I’m very impressed with it though I think we’ll soon get fed up with the catch phrase “There’s an extension for that”!
It’s also worth browsing the extensions in the library for hidden gems. For instance, it’s how I found out about CodeLift which simplifies creating Dockerfiles by doing all the donkeywork for you.