If you are just learning the quickly evolving C++ programming language, an open-source developer patching a zero-day vulnerability in a low-level C++ library, or experienced professional writing software in C or C++ for embedded devices or enterprise applications, GitHub Codespaces and Visual Studio Code combine to significantly lower the costs associated with configuring your environment, building, and testing your code. It doesn’t matter whether your computer’s operating system is Microsoft Windows, Apple macOS, or your favorite Linux distribution, Visual Studio Code works on them all. You can even work from the web browser of your mobile iOS or Android device.
GitHub offers built-in support for Visual Studio Code developers via github.dev. For any repository hosted on GitHub, you can nearly instantly open an instance of Visual Studio Code directly in your web browser. In this environment, many of Visual Studio Code’s navigation and editing features are fully functional. You can search for strings in your repository or edit files and commit them to new branches. You can even install many of the great Visual Studio Code extensions from the Visual Studio Code Marketplace.
Once you push changes to your repository using github.dev, any GitHub Actions that are registered for your branch will execute, including any build or test actions such as the Microsoft C++ Code Analysis action. But you might want to build and test your changes before pushing your changes up to GitHub. For this, you can create or connect to an existing GitHub Codespace directly from Visual Studio Code (including the in-browser instance loaded by github.dev) or from the normal GitHub web page for the repository. NOTE: GitHub Codespaces is currently only available to members of eligible organizations. See Known Limitations for more information.
The extensibility model for Visual Studio Code is one of its most powerful features. It enables developers across the globe to produce terrific extensions. Microsoft has bundled many of the best extensions for C and C++ development into the C/C++ Extension Pack, which makes developing for one of the world’s most versatile programming languages as easy as it’s ever been. From extensions for build systems like Make and build system generators like CMake, to debugging and C++ static analysis tools and rich editor features like syntax highlighting and IntelliSense code completion, Visual Studio Code has what you need to get the job done, and it continues to improve with every release. Combining Visual Studio Code’s terrific support for C++ development with GitHub Codespaces’ ease-of-use and portability, means that it’s easier than ever before to deliver your product or solution.
Since Codespaces are development environments in the cloud, they are accessible from practically any system or device with a web browser and an Internet connection. And when you disconnect from your Codespace, its state is saved so that when you reconnect, potentially from a different device in potentially a very different location, you’ll be right back where you left off. When you are relaxing on the white sands of a beach resort, you no longer need to run back to your office (or home office) in order to fix that critical zero-day bug that just read about on Reddit.
Managing your Codespace instances can be done directly from GitHub or from within the Visual Studio Code Remote Explorer. From there, you can see the properties of your Codespaces or create, delete, or connect to your Codespaces. You can even change the machine type of an existing Codespace from the GitHub page or via the Command Palate in Visual Studio Code after connecting to a Codespace.
A machine type is a system configuration specifying the number of CPU cores, memory capacity, and storage capacity for a Codespace. GitHub Codespaces are provisioned in the cloud with the machine type you select. Depending on the organizations you are a member of, the repository a Codespace is being created for, and details about your GitHub account, different machine types might be available to you. To start, don’t worry about selecting the perfect machine type for your Codespace. You can always change your machine type later and retain all of your code changes without having to stash or commit them into the repository. Since less powerful machine types are billed at a lower rate, you can leverage this to really optimize the tradeoff between time and cost as you see fit. For instance, you might choose a powerful machine type in order to complete an initial build of your project, then switch to a less powerful machine type while you are only making changes that cause smaller, incremental builds, only to switch back to a more powerful machine when you’d like to run a compute intensive task like running a static analysis tool.
The creation of your Codespaces are also customizable with devcontainer configuration files checked directly into your repository. You can provide a custom Dockerfile to use when spinning up your Codespace, pre-install Visual Studio Code extensions, forward ports from your Codespace instance to your local machine, or even run a tool every time a connection is made to the Codespace. You can even pre-build your Codespace containers using GitHub Actions to make Codespace startup very fast!
- Access to GitHub Codespaces feature is limited to users who are members of organizations on a GitHub Teams or GitHub Enterprise Cloud plan. Organization owners can enable the feature in only a few steps. Access for individual users is currently in beta, to which you can easily request access.
- All GitHub Codespace instances run various Linux distributions.
- The largest available machine type is: 32 cores, 64 GB RAM, 128 GB storage.
- Changing machine type is only allowed between types that have the same amount of storage capacity.