# Set Up Visual Studio Code on the Workstation
=== A reference for [Yao Group workstation Infrastructure Note](https://hackmd.io/dd8wi827SpCLAe8p2Ype6w) ===
This guide teaches how to use Visual Studio Code to develop code on our workstation.
:::success
[Our training session recording](https://princeton.zoom.us/rec/share/B37MWuRTVkHTkpo_2X9njmZugexJtN7SuIjLr4lty8DyFCDQPB-vjkQjzsV1dDWB.7AYAUTr9W4GvHxrH) might help
:::
### 1. Install
Install [Visual Studio Code](https://code.visualstudio.com/). It should be easy. Download, then click the installer.
### 2. Remote Devlopement
* a. Set up the key-based authentication between your local PC/laptop and the server. You can follow the "How can I avoid typing password each time" in [this guide](https://hackmd.io/9iVBJfITQwy8tIz9ubgorw?view#Q-How-can-I-avoid-typing-password-each-time). Especially make sure the public key is added to `~/.ssh/authorized_keys` on the workstation.
* b. Click the Extensions on the left panel, install the Remote-SSH extension. The extension allows us to access the workstation within VSCode via SSH.

* c. Press `Ctrl + Shift + P` to trigger Command Palette (or similarly, click View->Command Palette). Select `Remote-SSH: Connect to Host...` , select `Configure SSH Hosts` and open a configuration file.

* d. Type the following into the configuration file, but remember to **change the User to your username on workstation**, and **IdentityFile with the private key file (id_rsa) created in step a**.
```
Host YaoGroup
HostName sdss-yaolai.stanford.edu
User nbcoffey
IdentityFile /users/nbcoffey/.ssh/id_ed25519
```
It looks like this:

* e. Now click `Remote-SSH: Connect to Host...` again. This time an option `YaoGroup` will appear, and you be able to connect it without typing any password, and a new window will appear (password is asked, when SSH identity goes wrong, please check to step a, b & d)
* f. Verify you are using the workstation by open a folder.
