Developing code remotely using Visual Studio Code

I’m a recent convert from GitHub’s to Microsoft’s Visual Studio Code, thanks to an old friend who told me “Yes, it’s Microsoft, but it’s *actually very good*”. Until now, I’ve been using it as a like-for-like replacement for Atom, to edit the occasional markdown and YAML, but today I feel like I took my usage to the next level..

Yes, it’s Microsoft, but it’s actually very good

I’d seen some tweets recently about new remote development features in VSCode

…but it sounded unnecessarily complicated (Why do I need a Windows subsystem for Linux??), and I didn’t have a reason to test it out until today. I needed to edit a series of complex YAML/Python files on a remote docker host, and I was tired of editing locally and SCPing them across, or mucking through using vim.

So I set aside my reservations, and followed the docs. I quickly discovered that I needed the “insider” edition of VS Code for this to work.

Here’s how complicated it is:

# Remove old vscode
brew cask remove visual-studio-code

# Install new, bleeding-edge version
brew tap homebrew/cask-versions
brew cask install visual-studio-code-insiders

# (Realize that I hadn't backed up / copied any of my settings, 
# but don't care since I'd not customized it very much

Now open VSCode Insiders (the app has a new name), and install the Remote Development extension pack.

You get a new icon on the “vertical ribbon thing”. When you click this icon, you see your saved SSH sessions from ~/.ssh/config (good on ya, Microsoft, for not maintaining a *separate list of SSH connections*)

Connect to your remote host, and boom - you’re done. You get a new “project” window, and you can remotely open any file on the target host.

Also handy - you can directly open a terminal on the target host, with the ^` shortcut key combination. Now you can edit multiple files on the target host, and run multiple sessions on that target host, all from inside the VSCode window.

That’s a win, and I’m a convert!

Cover photo thanks to unsplash-logo Victor Larracuente

© 2019. All rights reserved.