Using Visual Studio Code

Visual Studio Code is a popular development environment with versions available for Windows, Mac OS X and Linux. This page describes some of the issues with using VS Code on ALICE, and the workarounds available.

Running VS Code on ALICE Directly

You can install VS Code yourself on ALICE. Choose the x64 tar.gz version from the Download Visual Studio Code page. Unpack the tarball into a suitable location in your home directory and execute it by running the code executable within it.

In the example below the tarball code-stable-x64-1696243801.tar.gz has been downloaded, is unpacked and moved to the folder software:

tar -zxf code-stable-x64-1696243801.tar.gz
mv VSCode-linux-x64 ~/software/

To start VS Code:

~/software/VSCode-linux-x64/code

An alias could be made to start VS Code and added to your .bashrc file, e.g.

alias code='~/software/VSCode-linux-x64/code'

Connecting to ALICE with VS Code via SSH

By making use of the Remote - SSH extension it is possible for VS Code to edit files remotely over a SSH session, as well as provide a remote terminal.

Unfortunately VS Code fails to work with ALICE when connecting from the internet as it cannot handle MFA correctly. VS Code makes two SSH connections to create a remote session, and although the initial connection can be made, the second connection will not handle the MFA requirement. Mac and Linux users may have more success as they can make use of SSH multiplexing for the second connection.

A second issue is that when connecting to alice.le.ac.uk, a client can be connected to any one of our four login nodes. This use of an address alias confuses VS Code, as its second SSH connection is not necessarily made to the same login node as the initial one.

By using the University VPN it is possible to get VS Code to connect to ALICE as long as a specific node is used. Having the VPN in place means that MFA is not required.

Therefore Windows VPN users should configure VS Code to connect to a specific login node, that is any one of the following:

  • alice-login01.rcs.le.ac.uk
  • alice-login02.rcs.le.ac.uk
  • alice-login03.rcs.le.ac.uk
  • alice-login04.rcs.le.ac.uk

When prompted to add the host to your .ssh\config file, use the following. Substitute NN in the alice-login details with one of 01, 02, 03, 04. For the user name, replace nye1 with your own UOL username.

Host alice-loginNN
   HostName alice-loginNN.rcs.le.ac.uk
   User nye1
   ServerAliveInterval 120
   ServerAliveCountMax 2

The ServerAliveInterval and ServerAliveCountMax settings are useful to prevent an idle SSH connection being disconnected automatically.