VSCode
Visual Studio Code
Visual Studio Code
Visual Studio Code is a programming text editor. Its Remote Development Extension supports working on the CS Linux machines remotely from your computer. Under the hood, the Remove Development Extension uses SSH, the Secure Shell. If you are not using VSCode, you can learn about using SSH directly here.
Contents
- Install
- Connect to the CS Linux Machines with SSH
- Find and Edit Files on the CS Linux Machine
- Run Commands on the CS Linux Machine
- Exit
- License
Install
Install VSCode
Follow the instructions for your operating system:
The main “Installation” section on each of these pages should be enough.
Privacy Note
By default, VSCode collects data about your usage of the application and sends it to Microsoft. You may wish to disable “telemetry” reporting when you first launch VSCode.
Install the Remote Development Extension
- Start VSCode. It will automatically open some documentation windows.
- Click the extensions icon on the left hand side.
- Search for "remote development"
- Click on "Remote Development". That will put info about that extension in the main window.
- Click on the "Install" button under the Remote Development title.
Connect to the CS Linux Machines with SSH
After the installation steps above, and after launching the VSCode application, you can use it to edit remote files:
- In the lower left of the VSCode window, you'll see a green icon that looks like this:
- Click on the green icon (hover says: "open a remote window"). At the top of VSCode, you'll see a menu like this:
- Choose "Remote-SSH: Connect to Host" and connect
to
youraccount@cs.wellesley.edu
. (Replaceyouraccount
with your CS username.) Looks like this: - If prompted about a "fingerprint" for cs.wellesley.edu, continue.
- Enter your CS (not Wellesley!) password when prompted.
- If you succeed, VSCode will show some progress status in the bottom of the window and eventually the lower left of the VSCode window will show the remote connection, like this:
Find and Edit Files on the CS Linux Machine
Editing files on the remote machine is pretty straightforward:
- Click on the Explorer Icon (or command-shift-e)
- Choose "Open Folder" under connected SSH
- Choose a folder on your remote machine, such as
public_html
- Open or create a file, such as
hello.txt
. Edit it. Save it.
As an alternative to the graphical user interface for opening files,
you can also use the code
command in a terminal to open a file. See below.
Remember, you are working on a remote machine through VSCode, so you will not see these remote files if you look around on your local computer through other applications.
Run Commands on the CS Linux Machine
To run commands on the remote machine through VSCode, open a terminal from within VSCode:
- From the Terminal menu in VSCode, choose “New Terminal”. This opens a terminal on the remove machine (cs.wellesley.edu) over SSH.
- Run any commands in the terminal.
- For example, if you are working in your home directory and you want
to open a file called
my-file.txt
, you could use the commandcode my-file.txt
. That will open the filemy-file.txt
for editing in VSCode. - See more about command line tools in Assignment Zero or on the tools reference page.
Exit
- logout from your terminal window, and
- click on the remote session icon and choose "Close remote connection"
- quit VSCode
License
This page is adapted from Scott Anderson’s similar page for CS 304. © Scott D. Anderson. This work is licensed under a Creative Commons License.