VSCode

← Back to Research Lab

Summary. Visual Studio Code (VSCode) is the lab’s default code editor. It is free, cross-platform, and — with a few extensions — handles our Python work, Jupyter notebooks, Git, remote lab machines, and Docker from a single window. This guide covers installing it, the extensions we recommend, and a baseline configuration.

Prerequisites

Install

Windows

  1. Download the User Installer from https://code.visualstudio.com/.
  2. Run the installer. On the Select Additional Tasks screen, tick “Add to PATH” and “Register Code as an editor for supported file types”.
  3. Launch VSCode from the Start menu.

macOS

  1. Download the macOS build from https://code.visualstudio.com/ (choose Apple Silicon or Intel to match your Mac).
  2. Unzip and drag Visual Studio Code.app into Applications.
  3. Open VSCode, then press Cmd+Shift+P and run “Shell Command: Install ‘code’ command in PATH” so you can launch it from the terminal with code ..

Linux (Debian/Ubuntu)

sudo apt-get update
sudo apt-get install -y wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
rm -f packages.microsoft.gpg
sudo apt-get update
sudo apt-get install -y code

On other distributions you can install the Snap (sudo snap install code --classic) or the .rpm/.deb package from the download page.

Verify the install from a terminal:

code --version

Recommended Extensions

Open the Extensions view with Ctrl/Cmd+Shift+X and search by name, or install from the terminal with code --install-extension <id>.

ExtensionIDWhat it does
Pythonms-python.pythonCore Python support: run, debug, select interpreter
Pylancems-python.vscode-pylanceFast IntelliSense and type checking
Jupyterms-toolsai.jupyterRun and edit .ipynb notebooks inside VSCode
Ruffcharliermarsh.ruffFast Python linter/formatter
Black Formatterms-python.black-formatterOpinionated Python code formatter
GitLenseamodio.gitlensRich Git history, blame, and comparisons
Remote - SSHms-vscode-remote.remote-sshEdit code on a lab server/robot over SSH
Dockerms-azuretools.vscode-dockerBuild and manage Docker images/containers

Lab note: (list any extensions that are required/standard for our projects here — to be added.)

Install the core set in one command:

code --install-extension ms-python.python \
     --install-extension ms-python.vscode-pylance \
     --install-extension ms-toolsai.jupyter \
     --install-extension charliermarsh.ruff \
     --install-extension eamodio.gitlens

Configuration

Select the Python interpreter

Open a project folder (Ctrl/Cmd+K Ctrl/Cmd+O), then press Ctrl/Cmd+Shift+P and run “Python: Select Interpreter”. Pick the environment you created in the Python Environments guide (e.g. your .venv or a conda env).

Baseline settings

Open the Command Palette → “Preferences: Open User Settings (JSON)” and add:

{
  "editor.formatOnSave": true,
  "editor.rulers": [88],
  "files.trimTrailingWhitespace": true,
  "files.insertFinalNewline": true,
  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    }
  }
}

Project-specific settings go in a .vscode/settings.json file committed with the repo, so everyone on the project shares the same setup.

Integrated terminal

Open it with Ctrl+` (backtick). It inherits your selected Python environment, so python, pip, and jupyter point at the right place.

Working on a Lab Machine (Remote - SSH)

To edit and run code directly on a lab server or a robot’s host computer:

  1. Install the Remote - SSH extension.
  2. Press Ctrl/Cmd+Shift+P“Remote-SSH: Connect to Host…”.
  3. Enter user@hostname (or pick a host from your ~/.ssh/config).
  4. Once connected, open the remote folder — extensions like Python run on the remote machine, not your laptop.

Lab note: (add the lab’s server/robot hostnames and SSH access instructions here — to be added.)

Useful Shortcuts

ActionWindows/LinuxmacOS
Command PaletteCtrl+Shift+PCmd+Shift+P
Quick open fileCtrl+PCmd+P
Toggle terminalCtrl+` | Cmd+` 
Format documentShift+Alt+FShift+Option+F
Comment lineCtrl+/Cmd+/
Go to symbolCtrl+Shift+OCmd+Shift+O

Tips & Troubleshooting

References