This page explains how you can remotely access your CS lab files through vscode if you want to work from home.
You can use Visual Studio Code (“vscode”), installed on your computer, to edit files on the CS lab computers. Here’s the outline of how to do that:
install vscode on your laptop
install the remote-ssh extension
configure the remote-ssh extension
connect to a computer
and when done, close the remote connection
That last step (closing the connection) is important as vscode sometimes leaves stray processes running if you don’t close everything when done, and some of these processes can consume large amounts of CPU and memory.
installing vscode
Starting at the vscode website you should be able to select the version most appropriate for your computer. For example, on a Mac, you should be presented with a button that allows you to “Download Mac Universal” and on Windows you should see “Download for Windows”.
installing the Remote-SSH extension
In order to edit files on the CS computers, you will need to install the Remote-SSH extension:
start vscode if it is not already running
click on the extensions icon () on the left side of the vscode window to open the Extensions panel
at the top, in the Search bar, type in “remote ssh”
check to make sure you have the correct “Remote - SSH” extension (created by Microsoft, over 16 million downloads)
click the “Install” button
configuring the Remote-SSH extension
Now that you’ve installed the Remote-SSH extension, we need to configure it.
click the “open a remote window” icon () at the bottom left of the vscode window
choose “Connect to Host… Remote-SSH” in the dropdown
select “+ Add New SSH Host…”
type “ssh USERNAME@cslab.cs.swarthmore.edu” where USERNAME is your login ID at Swarthmore (e.g. csmajor1) and press return
at the “Select SSH configuration file to update” prompt, just press return to select the default first option
a popup should appear at the bottom right of the screen that says “Host added!”
Note: cslab.cs.swarthmore.edu is an alias that gets expanded to one of many computers. If you want to connect to a specific computer, such as coconut, then use that hostname when adding a new ssh host.
Using the Remote-SSH Extension
Every time you want to use the Remote-SSH extension, you will need to follow these steps:
start by clicking the “open a remote window” icon () at the bottom left of the vscode window
choose “Connect to Host… Remote-SSH”
select the hostname you configured (e.g., cslab.cs.swarthmore.edu)
if this is the first time you are connecting to a host, it will show the host ssh fingerprint and ask if you want to continue connecting (press “Continue”)
type your CS password in the next box
in the bottom right of the screen, it will say “Setting up SSH Host cslab…” This may take 30-60 seconds to complete.
once connected, choose “Open Folder”, where you can pick a working directory
you may get a window pop up that says “Do you trust the authors of the files in this folder?” Press the button that says “Yes, I trust the authors”.
use the navigation pane on the left side to select the file you want to edit.
closing the connection
When you are done working, please remember to close the connection. Use the green button in the bottom left corner to Close Remote Connection.