Skip to content

Editors

cam edited this page May 12, 2021 · 2 revisions

Introduction

There are many different editors you could use with your container. This document will describe suggested setup steps and tips for handling this with your Docker environment.

VSCode

Using Remote Containers Extension

Using the Remote Containers Extension will attach your editor to the Docker container so the editor can use our specific compiler and debugger for Intellisense, auto-complete, jump-to-definition even if you don't have a C++ compiler installed natively.

This should fix errors such as:

  • include errors detected for #include "gtest/gtest.h"
  • unexpected errors appear in editor but no errors when compiling in Docker

Step 0: start the container

Start the csci104 container in the background:

ch start csci104

Step 1: Install Remote Containers Extension

Install the VSCode Remote Containers Extension. You can do this by following this link and selecting Install. Or, you can search for this in VSCode by searching for the extension id: ms-vscode-remote.remote-containers

Step 2: Attach to Container

Open the Remote Explorer tab in VSCode on the left sidebar. Select "Containers" from the top-level dropdown. You should see a container running: usccsci104/docker:20.04. If you see a folder /work, click the folder icon. Otherwise, right click and select "Attach to Container". This will open a new VSCode window and may take some time to load.

If you are prompted to give a filepath, use the path: /work

Step 3: Install C++ Extensions (Recommended)

Finally, you should make sure that you install C++ extensions in your container if you don't already have these extensions locally. A highly rated one would be: ms-vscode.cpptools

Step 4: Enjoy Intellisense Goodness

You should be all setup now! Try opening your homework and any Google Tests. Any #include errors should be gone now and you should have some autocompletion and go-to-definition functionality.

CLion

CLion is made by JetBrains and is an incredible editor with great static analysis and refactoring capabilities.

As a college student, you are qualified for an educational licenese of JetBrains IDEs. With this, you can install and use CLion. Follow this link to # for the license.