Skip to content
Snippets Groups Projects

Add documentation for running VS-Code

Merged Mohammed Tanash requested to merge add-vscode-doc into master
9 files
+ 75
0
Compare changes
  • Side-by-side
  • Inline
Files
9
+++
title = "Visual Studio Code on HCC resources"
description = "How to run VS-Code on HCC resources."
+++
[Visual Studio Code (VS Code)] (https://code.visualstudio.com/) 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]({{< relref "../../open_ondemand/virtual_desktop_and_interactive_apps.md" >}}). 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](https://code.visualstudio.com/docs/remote/tunnels) 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]({{< relref "../../open_ondemand/virtual_desktop_and_interactive_apps.md" >}}).
**Step 2:** Open the terminal within the Open OnDemand Interactive Desktop and type:
```Bash
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]({{< relref "../../submitting_jobs/creating_an_interactive_job.md" >}}) 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.
```Bash
srun --mem=16gb --nodes=1 --ntasks-per-node=4 --time=24:00:00 --pty $SHELL
```
{{< figure src="/images/vscode/vscode-1.png" height="150" >}}
**Step 2:** After the interactive job has started, the next step is to load the VS Code module.
```Bash
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](https://code.visualstudio.com/docs/remote/tunnels#_remote-tunnels-extension) 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.
{{< figure src="/images/vscode/vscode-2.png" height="300" width="1200" >}}
{{< figure src="/images/vscode/vscode-3.png" height="200" >}}
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.
{{< figure src="/images/vscode/vscode-4.png" height="200" >}}
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.
{{< figure src="/images/vscode/vscode-5.png" height="300" >}}
{{< figure src="/images/vscode/vscode-6.png" height="400" >}}
Please note that with this setup, you can launch the VS Code GUI on your computer, but work on Swan.
Loading