Using VS Code with Bellagio#
These instructions are for Visual Studio Code, often abbreviated as VS Code. This is different from Visual Studio, a separate full-featured IDE primarily for Windows.
Current course announcements, account instructions, and your syllabus control current-semester setup details. Use this page for the stable VS Code workflow.
Download Visual Studio Code from https://code.visualstudio.com/.
Important server note#
VS Code extensions may negatively affect your storage quota on Bellagio. Extra extensions can also add server load.
If you are using Visual Studio Code to connect to Bellagio, disable the built-in TypeScript and JavaScript language features:
- Click the Extensions button in VS Code.
- Type
@builtin TypeScriptinto the search bar. - Disable the TypeScript and JavaScript Language Features extension.
- Reload VS Code.
This helps reduce server load.
Part 1: Download and install VS Code#
Windows#
- Go to https://code.visualstudio.com/.
- Click the Windows download button.
- Run the downloaded installer.
- Accept the license agreement.
- Keep the default installation location unless you have a reason to change it.
- Select Add VS Code to PATH if offered.
- Finish the installation and open VS Code.
macOS#
- Go to https://code.visualstudio.com/.
- Click the macOS download button.
- Open the downloaded ZIP file.
- Drag Visual Studio Code into the Applications folder.
- Open Visual Studio Code from Applications.
Part 2: Install required extensions#
Open the Extensions panel. It is the button that looks like blocks in the left toolbar.
Install:
- Remote - SSH by Microsoft
- C/C++ by Microsoft
Choose the C/C++ extension by Microsoft, not the C/C++ Extension Pack. The extension pack installs additional components that may consume more storage than you need.
If VS Code recommends the C/C++ Extension Pack later, use the gear icon in the prompt and choose not to show the recommendation again.
Part 3: Show the 80-column guide#
Course programming standards may require lines to stay within a specific column width. VS Code can display a vertical guide at column 80 so you can see when a line is getting too long.
-
Go to File > Preferences > Settings.
-
In the search bar, type
rulers. -
Under Editor: Rulers, click Edit in settings.json.
-
Add this setting:
"editor.rulers": [80]
This displays a vertical guide at the 80th character position in the editor.
Part 4: Add Bellagio as an SSH host#
Use the server name and Bellagio username supplied in your official course account instructions. Do not guess your username from another identifier. If you do not know your Bellagio username, check the current course instructions or ask for help through the approved course support channel.
-
Open the Command Palette.
- Windows:
Ctrl+Shift+PorF1 - macOS:
Cmd+Shift+PorFn+F1
- Windows:
-
Type
Remote-SSH: Addand select Remote-SSH: Add New SSH Host…. -
Enter your SSH connection string using this form:
ssh your-bellagio-username@server-name-from-course-instructions -
Replace the placeholders with the values from your course account instructions.
-
Choose the default SSH configuration file when prompted.
Your SSH configuration file should contain an entry like this:
Host bellagio-course-server
HostName server-name-from-course-instructions
User your-bellagio-usernameFor Windows users, the server configuration may also require:
MACs hmac-sha2-256Save the file after making changes.
Part 5: Connect to Bellagio#
- Open the Command Palette.
- Select Remote-SSH: Connect to Host.
- Choose the host entry you created for the course server.
- If prompted to trust the server identity, type
yes. - Enter your password when prompted. The characters may not appear as you type.
- If prompted for the remote platform, choose Linux.
- Open your project folder from the Explorer.
- If asked whether you trust the authors of files in the folder, select Yes, I trust the authors for your own course files.
After the connection finishes, VS Code is working on Bellagio.
Part 6: Open the terminal#
Use Terminal > New Terminal.
You can also use:
Ctrl+`The terminal is connected to Bellagio, so commands run on the server.
Part 7: Test C++ development#
Create a project directory:
mkdir -p ~/cs202/project
cd ~/cs202/project/Create a file named hello.cpp:
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}Compile the program:
g++ $CXXFLAGS hello.cpp -o helloRun it:
./helloExpected output:
Hello, World!Part 8: Log out and reconnect#
When finished, use File > Close Remote Connection or close the VS Code window connected to Bellagio.
To reconnect later, use Remote-SSH: Connect to Host and choose the host entry you created for the course server.
Optional: Code Runner#
Code Runner can compile and run files from inside VS Code, but it consumes
storage quota on Bellagio and may not use $CXXFLAGS by default.
Use the terminal unless your instructor specifically recommends Code Runner for your workflow.