VS Code - Setup
To use VS Code on the server, you need to create an SSH key. If you have ever done this before on your current computer, you don't need to do it again, and you can skip to the Connect to VS Code Remote section.
First Time Setup
Change VS Code's Connection Timeout Setting
The first time you connect to the server, it will install all of the Python and R packages you need. This process takes several minutes, however, and VS Code defaults to waiting only 15 s after login for any processes to end. Long story short, if you don't change this setting, VS Code will disconnect you before all the packages get installed.
Open Settings
from the VS Code menu and in the search bar type remote timeout
. Change the value of Remote.SSH: Connect Timeout
to 300.
Configure Extensions to Auto-Install in VS Code Remote
You'll always need extensions when working in VS Code — at the very least, the Python and Jupyter extensions, GitHub Copilot, R, and probably some others. Below is a suggested list.
Even if you installed these extensions in VS Code on your laptop, they won't automatically be installed in your server installation of VS Code. Do the following to define the extensions that you always want to be installed in a remote VS Code session (doing this will also ensure that all your extensions are re-installed if the server OS is reinstalled, which happens frequently).
In VS Code, go to Settings
and in the search bar type extensions
. In the left sidebar of results, click Extensions
then select Remote-SSH
. You'll see an Add Item
button. Click that and then paste each of the extension names below in, clicking OK
then Add Item
for each one (you can't paste in a list, unfortunately):
Connect to VS Code Remote
First Time
Open VS Code on your computer, and type Cmd-Shift-p
(Ctrl-Shift-p
on Windows).
In the box that pops up, start typing Remote-SSH: Connect Current Window to Host...
Select this option when it pops up, then click + Add New SSH Host
In the box that pops up, enter: ssh github-username@ncil.psychology.dal.ca —
Except replace github-username
with your actual GitHub username. Save the configuration by clicking the first option in the list you see (it will end in .ssh/config
).
The first time you connect, as noted above, there will be a delay of a few minutes while your Python and R packages are installed.
After the First Time
In future sessions, you will still need to Cmd-Shift-p
(Ctrl-Shift-p
on Windows) Remote-SSH: Connect Current Window to Host...
but you can just select your saved configuration rather than typing the whole ssh command every time.
Alternatively, you should install the Remove Development VS Code extension. Then you'll have an icon in your Activity Bar (left side of window) that looks like a screen with a little circle in the bottom right corner. Each different folder on the server that you've connected to via SSH in the past will show up here, and you can just click the -> arrow next to its name to connect again.
Last updated
Was this helpful?