Getting Setup in Visual Studio Code

Lee Napthine

This blog post gets us started with Visual Studio Code (VS Code). It is intended for onboarding at ARCsoft, and should help sync IDE enironments with the Git projects. Topics include install, startup, formatting, extensions, and shortcuts.


Install

First, let’s install Visual Studio Code. You’ll need it installed on your Windows environment to access WSL (Windows Subsystem for Linux).

  1. Visit the Microsoft store.
  2. Hit install.

Open VS Code

You can open VS Code in a couple of ways:

  1. From the Start Menu, search for “Visual Studio Code.”
  2. From the terminal or command prompt, navigate to your project folder and type:
   code .

This command opens the current folder as a project in VS Code.


Formatting

To ensure code consistency and avoid linting issues, always save files in UNIX mode. Unix/Linux/MacOS use a Line Feed (\n), while Windows uses a Carriage Return + Line Feed (\r\n). You can check which format you’re using by looking at the bottom right corner of VS Code, where it shows either ‘LF’ or ‘CRLF’:

LF

Set Default Line Ending to LF:

  1. Click on the settings icon at the bottom left corner of the page → ( Settings )
  2. Go to settings.
  3. In the Search settings bar, type: eol.
  4. Choose \n (Line Feed) as the default end-of-line character.

Extensions

You’ll find your extensions under the View tab or by hitting Ctrl+Shift+X. Extensions are largely a matter of preference, and can speed up your work flow. Be mindful of the extensions you install though, as auto-formatters can modify code in unexpected ways, potentially leading to test failures.

A must-have extension is Remote - SSH, which lets you code using VS Code on a virtual machine.


Shortcuts

Shortcut Description
Ctrl+P Navigate files by name
Ctrl+Shift+P Access the Command Palette
Ctrl+J Toggle the terminal