Skip to content

Visual Studio Code on HCC resources

Visual Studio Code (VS Code) is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C---, C#, Java, Python, PHP, Go, .NET).

Using Code Server via Open OnDemand

HCC provides Code Server as Open OnDemand App. However, this version does not provide access to extensions from the Microsoft Extension Marketplace that may be needed for your work.

Using VS Code

The Microsoft version of VS Code available as system-wide module on Swan provides access to the Microsoft extensions. This way, you can launch VS Code within the Open OnDemand Interactive Desktop or use the Remote Tunnel feature to run the VS Code GUI locally and work on Swan.

Using VS Code via Open OnDemand

Step 1: Launch the Open OnDemand Interactive Desktop App.

Step 2: Open the terminal within the Open OnDemand Interactive Desktop and type:

module purge
module load vs-code/1.90
code
With this, the VS Code GUI will be launched in the Interactive Desktop.

Using VS Code via the Remote Tunnel feature

Step 1: Start an interactive job using the Swan terminal. The example below starts an interactive job with runtime of 24 hours and 16GBs of RAM, but please adjust these values accordingly.

srun --mem=16gb --nodes=1 --ntasks-per-node=4 --time=24:00:00 --pty $SHELL
[hccdemo@login1.swan ~]$ srun --pty --mem=16g -N 1 --ntasks-per-node=4 --time=24:00:00 $SHELL
srun: job 7514030 queued and waiting for resources
srun: job 7514030 has been allocated resources
[hccdemo@c0708.swan ~]$

terminal message that job has been queued and allocated resources

Step 2: After the interactive job has started, the next step is to load the VS Code module.

module purge
module load vs-code-cli/1.90
code tunnel --accept-server-license-terms

Step 3: Once the VS Code module is loaded and you run code tunnel, you can use the instructions here to run the GUI locally and work on Swan. In the prompt, you can login with either your Microsoft account or GitHub account. In the example below, we use GitHub account to login.

[hccdemo@c2508.swan ~]$ module purge
[hccdemo@c2508.swan ~]$ module load vs-code-cli/1.90
[hccdemo@c2508.swan ~]$ code tunnel --accept-server-license-terms
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
? How would you like to log in to Visual Studio Code? › 
  Microsoft Account
> GitHub Account

Logging in with GitHub Account

After selecting GitHub account, you'll be prompted to follow a URL to log in:

* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
✔ How would you like to log in to Visual Studio Code? · GitHub Account
To grant access to the server, please log into https://github.com/login/device and use code 1006-9F1F

Logging in with GitHub Account

If you use GitHub account, then you need to login to https://github.com/login/device from your computer web browser and enter the provided code to grant access to the server.

screen where you can Authorize Visual-Studio-Code

After you grant access, you will be provided a link in the Swan terminal you used for the setup. You need to copy the provided link from your terminal and paste it into your computer web browser in order to start VS Code.

*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
✔ How would you like to log in to Visual Studio Code? · GitHub Account

[info] GitHub login successful!

[info] Tunnel is registered as: swan-c2508
[info] Visual Studio Code Server is listening on https://vscode.dev/tunnel/swan-c2508

link in terminal

VS Code in web browser

Please note that with this setup, you can launch the VS Code GUI on your computer, but work on Swan.