Back to Archive

VS Code extension case study

C C++ Toolkit

C C++ Toolkit is a Visual Studio Code extension I built to cut down the setup work that usually comes with C and C++ projects. Instead of creating folders, CMake files, launch configurations, and repeated build commands by hand, the extension puts the common workflow behind a smaller set of editor commands and status-bar actions.

C C++ Toolkit Visual Studio Code extension screenshot

The project came from a problem I had already been explaining manually. Setting up a multi-file C or C++ project in VS Code is rarely hard in principle, but it is confusing for students and beginners who are still learning what GCC, GDB, CMake, Ninja, and the .vscode configuration files actually do. I wrote a setup guide first, then turned that setup knowledge into a tool.

I built the extension in JavaScript for the VS Code runtime, added project and component generators, wired in build and debug flows, and added cross-platform tool detection and installation support. It went on to become my most widely used open-source project, with more than 22,000 downloads on the Visual Studio Marketplace. It is most useful at the start of the learning curve, where strong defaults help more than they hurt.

Project Brief

Type
VS Code extension
Platforms
Windows, macOS, and Linux
Core workflow
Project generation, component generation, build, run, debug, test
Tooling
CMake, GCC, GDB, Ninja, Make, Git, VS Code tasks and launch configuration
Package support
APT on Linux, Homebrew on macOS, Scoop on Windows
Distribution
GitHub and Visual Studio Marketplace
22k+Marketplace downloads
7status-bar actions
2project generators

Why This Tool Needed to Exist

01 The Friction

A basic C or C++ project in VS Code often starts with a pile of manual setup: create the folder structure, write the root CMakeLists.txt, add starter source files, configure IntelliSense, define tasks, set up launch profiles, and remember the right build and debug commands.

That gets much easier once you already understand GCC, GDB, CMake, Ninja, and the .vscode configuration files, but that is the barrier. For many beginners, especially students coming from hardware or mechatronics backgrounds, VS Code can feel like it is missing something obvious compared with IDEs that hide the build system behind buttons.

The gap was real. VS Code already had strong C and C++ language support through Microsoft's C/C++ extension, but that extension does not set the project up for you. Newcomers often ended up on runner-style extensions that work fine for a single source file, then fall apart as soon as the project needs multiple files, headers, and a real build structure.

02 The Goal

The goal was to keep a normal CMake workflow, not invent a custom build ecosystem. The extension wraps the repetitive parts in a cleaner editor experience.

In practice, that meant codifying the same setup steps I had already been walking people through by hand: create a sane project structure, generate the VS Code configuration that makes IntelliSense, tasks, and debugging behave properly, expose the common actions directly in the editor, and help users recover when their machine is missing the expected toolchain.

Just as important, I did not want to solve the problem by hiding everything. A beginner can get short-term progress from an extension that compiles the current file and hides the rest, but that teaches very little about how C or C++ projects are actually built. C C++ Toolkit tries to make the initial workflow seamless while still keeping the underlying structure visible.

What the Extension Does

Status Bar Workflow

The extension adds a compact status-bar command surface for the actions developers keep repeating during the day: selecting build type, cleaning, building, running, debugging, testing, and debug-testing.

That makes the workflow visible and immediate instead of sending everything back through the command palette or terminal.

  • Build type selection between Debug, Release, and Test.
  • One-click clean, build, run, debug, test, and debug-test actions.
  • A faster inner loop for normal development and verification.

Project Scaffolding

New C and C++ projects can be created directly from the command palette. The generator asks for a base folder and project name, then creates a ready-to-use structure with starter source files, a root CMakeLists.txt, and the expected .vscode settings.

That gives the user a consistent first buildable version of the project without the usual copy-paste startup phase.

  • Separate generators for C and C++ projects.
  • Starter main.c or main.cpp plus CMake boilerplate.
  • Pre-created .vscode folder and project structure.

Component Generation

The extension can also add new components to an existing project. A generated component includes the usual include and source layout, its own CMakeLists.txt, and optional mock and test files.

The important part is that it does not stop at file generation. It also updates the root CMake configuration, so the new component is immediately part of the project instead of becoming another manual integration step.

  • Header and source generation for C or C++ components.
  • Optional mock and test scaffolding.
  • Automatic updates to the root CMakeLists.txt.

Environment Bootstrap

A clean workflow still fails if the machine is missing the expected toolchain. The extension checks whether the required tools are available in the system environment and offers to install missing ones through the platform package manager.

It was built to support the three desktop platforms developers were most likely to be using: Windows, macOS, and Linux. That was especially useful on fresh systems, where the real problem is often not the project itself but the missing surrounding toolchain.

  • APT support on Linux.
  • Homebrew support on macOS.
  • Scoop support on Windows, including Scoop installation support itself.

Technical Approach

01 Command Surface and Editor Integration

The extension was implemented as a JavaScript-based VS Code extension. The command surface combined command-palette actions with a smaller always-visible status-bar layer so the same workflow could serve both discovery and repetition.

That split mattered. Rare actions still fit naturally in the command palette, while frequent actions benefited from persistent buttons and faster access.

02 Scaffolding Around CMake, Not Around a Custom Toolchain

The generated projects and components were built around normal CMake structure. That kept the output understandable, editable, and portable outside the extension itself.

The extension does not hide the build system from the user. It gives the user a good baseline, keeps the generated structure predictable, and automates the repetitive edits that would otherwise be done by hand.

That decision came straight from the setup guide behind the project. The point was never to replace GCC, GDB, CMake, Ninja, tasks.json, launch.json, or c_cpp_properties.json. The point was to generate and maintain them in a way that stayed understandable.

03 Mock and Test Aware Component Generation

Component generation was designed to support more than just source creation. A component could optionally include mock files and test files, with matching CMake switches added to the root build so those variants could be compiled intentionally.

That made the structure more useful for disciplined development instead of stopping at bare file scaffolding.

04 Configuration Recovery Instead of Manual Repair

The extension also includes a configuration refresh command for regenerating the .vscode project configuration. Because overwriting local configuration can be risky, the refresh flow supports backup of the previous folder before regeneration.

That turns configuration drift from an annoying manual repair task into a controlled recovery flow.

Design Choices That Mattered

Keep the Workflow Inside the Editor

The extension deliberately brings the common build and execution cycle into the editor instead of assuming the developer wants to keep bouncing between the file tree, the command palette, and terminal commands.

It does not remove the terminal from the workflow. It removes the need to remember and repeat the same mechanical steps every time.

Structured Starting Point

The extension works best when the main problem is still "how do I get this project set up correctly?" rather than "how do I bend the build system around unusual requirements?" It gives a newcomer a stable starting point and a project layout they can inspect, modify, and learn from.

Reduce Onboarding Friction on Fresh Machines

Missing compilers, debuggers, or build tools are a common reason for failed first runs. Tool detection and OS-specific installation support made the extension useful earlier, especially on new or lightly configured systems.

Opinionated by Design

The extension is most useful for students and beginners. It gives them a stable starting point, sensible defaults, and fewer moving parts to understand on day one.

More experienced developers can still get value from the speed and boilerplate reduction, but that was never the main point. Once a project becomes large enough or specialized enough, the same generalization that helps a beginner can start to get in the way. That is normal, and it is part of the design tradeoff rather than a flaw I missed.

Conclusion

C C++ Toolkit is a productivity layer over a normal CMake-based C and C++ workflow. It automates the repetitive setup and editor configuration work, keeps common actions one click away, and lowers the friction of starting or expanding a project in VS Code.

This project worked because it stayed close to a real problem. It gave newcomers a structured on-ramp into C and C++ work in VS Code, then got out of the way once they no longer needed that much help. The 22,000-plus downloads matter because they show the tool was useful outside my own workflow.