Visual Studio Code cheatsheet

Reference commands for Microsoft’s cross-platform code editor based on Electron.

Command line

Visual Studio Code supports a command line interface, referred to as the command palette. It is accessible via Ctrl+Shift+P or View > Command Palette....

Workspaces

Code suports workspaces with multiple directories.

  1. Add directories with File > Add Folder to Workspace....
  2. Save the workspace with Save Workspace As....

Sync settings

Install the Settings Sync extension. Follow the instructions in the configuration guide, which uses GitHub Gist.

To manually download or upload settings, use the command palette.

GitLens

GitLens is an extension that supercharges Git, and it’s my favorite feature in Code. It enables you to visually compare across branches, tags, and specific commits with an intuitive interface. It also allows you to visually inspect files with specific commits marked in the margins.

Line wrapping

Install the Rewrap extension. Hard wrapping isn’t natively supported yet. I wrap my code at a width of 80 characters.

Markdown

Install the Markdown All in One extension.

R

R support currently isn’t great, and needs to be updated. At the point, I’d recommend using either RStudio or ESS.

Note on Atom

GitHub also maintains a similar code editor named Atom that is based on Electron. Microsoft has since acquired GitHub, and much of the functionality offered in Visual Studio Code is superior to Atom, in my opinion. I’d recommend switching over to Code from Atom, if possible.