VS Code#
Background and Installation#
VS Code, or Visual Studio Code, is a popular tool that allows for users to work in a variety of languages, including Python, Python notebooks, R, C, and more, all from one app. It also can work with Git and Docker. It is not currently an option as an interactive app in FASSE like RStudio or Jupyter, but you can still use VS Code in CANNON/FASSE fairly easily, in 2 ways:
Virtual Desktop
SSH Tunnel
Setting Up a Virtual Desktop#
Launch Remote Desktop in CANNON/FASSE and follow the steps to create a session.
Open VS Code: In a new Terminal window, run:
module load vscode code .
If you want a specific version of VS Code, you can type
module avail vscode
to show the available options, and then load your desired option.
Configure your
.bashrc
file to load necessary modules automatically:# .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi function mm() { module load vscode module load git module load python } export MY_NSAPH_SSH_USERNAME="USERNAME" export MY_NSAPH_SSH_PASSWORD="PASSWORD" export http_proxy=http://rcproxy.rc.fas.harvard.edu:3128 export https_proxy=http://rcproxy.rc.fas.harvard.edu:3128 WORK="/n/dominici_lab/lab"
Load VS Code, Git, and Python by running your function in Terminal (e.g.,
mm
).
Tip: For more details, watch this tutorial video.
Installing Extensions#
If you prefer not to configure .bashrc
, you can install language support manually:
Open Extensions from the sidebar.
Install language support for Python, Jupyter, Java, and more.
Customize VS Code with extensions for Git visualization, text editing, and themes.
Note: If you receive a message about an outdated Git version, run:
module load git/2.17.0-fasrc01before launching VS Code.
Setting Up an SSH Tunnel#
These directions are adapted from the official VS Code SSH setup guide.
Pre-requisites#
Before setting up the SSH Tunnel, ensure your .bashrc
file is configured as shown above.
Installation on Your Machine#
Install an OpenSSH-compatible SSH client if needed.
Install Visual Studio Code.
Install the Remote-SSH extension.
Set up an SSH host by following the instructions for:
Connecting to CANNON/FASSE#
In VS Code, open the Command Palette (
F1
or⇧⌘P
).Select Remote-SSH: Connect to Host… and enter:
username@login.rc.fas.harvard.edu
(for CANNON)username@fasselogin.rc.fas.harvard.edu
(for FASSE)
Enter your Harvard password, followed by your multi-factor authentication code (e.g., Microsoft Authenticator, Duo).
VS Code will establish the connection, displaying progress notifications and logs in the Remote - SSH output channel.
Once connected, you’ll see an empty VS Code window. The Status Bar (bottom left corner) shows the active remote session.
Open a folder or workspace using File > Open…, or clone a Git repository, just as you would locally.