Skip to content

Migrating to Visual Studio Code

Posted on:March 26, 2016

I’ve been testing out Visual Studio Code for writing Node stuff, and I really like what I’m seeing so far. I’d like to confess that 99.9% of the reason why I even considered trying it out in the first place was its ability to debug Node apps. I tried Intellij IDEA previously and was so put off by the IDE-like interface (my Eclipse days are still not quite past me) that I couldn’t bring myself to migrate over.

On first boot I immediately taken aback by how familiar to Sublime Text the interface was. I might even add that it feels somewhat snappier, although I can’t pin it down to a specific thing.

A comparison of VSC vs ST, listing only the features that I’ve used and enjoyed and the features I’m missing:

What VSC has

What VSC doesn’t have

Babel/ES6 Support

Of course, debugging my apps in VSC would mean that it has to be set up to run ES6 code, and I’m happy to report that this is very possible and very easy. In launch.json, simply set the runtimeExecutable to the babel-node binary in your project’s node_modules:

{
  "program": "${workspaceRoot}/index.js",
  "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node"
}

Configure the rest of your launch.json as per VSC’s documentation.

Note: There seems to be no good way of launching npm script commands from launch.json - will be investigating this in more detail.

Key Bindings

Most of the key bindings I use are the same. These are the only key bindings I’ve had to change so far to make it consistent with ST’s:

[
  { "key": "cmd+r", "command": "workbench.action.showAllSymbols" },
  { "key": "cmd+t", "command": "workbench.action.quickOpen" },
  { "key": "cmd+l", "command": "expandLineSelection" }
]

Theming

I use Afterglow in ST, and I’m happy to report that there is also Afterglow for VSC (just search for “Afterglow” in Extensions).

Packages

I’ve also found the following packages to be useful so far:

Git Support

I prefer to manage my Git stuff in the command line or in Tower, so I don’t really care for VSC’s built-in Git support, although from cursory inspection it seems quite similar to SublimeGit (which I use only for git blame and git checkout).