Visual Studio Code
Following guide is for connecting to a Neurodesktop using a VS Code installation running on your host machine.
Additional instructions if your Neurodesktop is running remotely (i.e. Cloud, HPC, VM)
Pre-requisites
Visual Studio Code (https://code.visualstudio.com) installed on your host. Standalone version should work fine
Install the following VS Code extensions:
- Docker extension (Required)
- Remote development extension pack. Includes the following extensions
- Remote - Containers (Required)
- Remote - SSH (For remote servers)
- Remote - WSL (For windows hosts)
For Remote servers
Open VS Code
Open the Command Palette (Ctrl+Shift+P)
Find Remote-SSH: Connect to Host...
and select your remote host
More information on remote hosts available at https://code.visualstudio.com/docs/remote/ssh
This will open a new VS Code instance connected to the remote host via SSH. You may close the previous VS Code instance.
Follow the steps in the next section using the new VS Code instance
Connecting to Neurodesktop
Open VS Code and open a Folder (File > Open Folder)
This can be any folder (e.g. home or project folder). VS Code runs into errors if no folder is opened.
Open the Command Palette (Ctrl+Shift+P).
Select Remote-Containers: Attach to Running Container
from the dropdown panel
Start typing in ’neurodesktop. Select /neurodesktop
from the list
This should open a VS Code Window connected to the neurodesktop as a Dev Container.
First time connection will take about a minute, as VS code has to install the VS Code server onto the container. Repeat connections should be faster
First time connection
First time connection will default to using neurodesktop root user. We want to default connection to be as the normal user to avoid permission issues. To check which user is being use, open the terminal in the neurodesktop VS Code and check if the user is
user
orroot
Follow the following steps to configure your VS Code to connect to neurodesktop as normal user by default
Open the Command Palette (Ctrl+Shift+P).
Select Remote-Containers: Open Container Configuration File
from the dropdown panel
This will open a neurodesktop%3alatest.json
file. Overwrite the file with the following contents
{
"workspaceFolder": "/home/user",
"remoteUser": "user"
}
Close this VS Code window. Use steps in previous section to connect normally
Useful Additions
A plugin to view neuroimaging data inside VScode is also available: