extending VSCode to improve your C++ development experience
Today we are announcing an open source project that we hope will extend the Visual Studio Code editing experience for C++ developers. Our goal is to give you even more productivity by enabling you to quickly create, build and debug your C++ code directly in VS Code.
In addition, the team is publishing a series of blog posts about how this extension was created, how it works and how you can use it to improve your own development. We are also making the source code available on GitHub so you can learn from our work and extend it for your own needs.
Why are we doing this?
The Visual Studio Code team is committed to empowering every developer by providing them with the tools they need to be productive with their code, regardless of the language or platform they are targeting. As part of our commitment to supporting all developers, we have been working closely with the C++ community over the last year to bring you a great set of features in Visual Studio Code that support cross-platform compilation and debugging with MSBuild and the Microsoft C++ compiler (MSVC). With this release we are opening up additional extension points that allow us to provide better support for other toolchain scenarios as well.
We believe that a
VSCode is a free, cross-platform source code editor that offers you the power of an integrated development environment (IDE) and the speed and flexibility of a lightweight text editor.
In this blog post, we’ll look at how to extend VSCode to improve your C++ development experience.
[If you’d like to learn more about VSCode, check out our series of videos on VSCode.](https://channels.theinnovationenterprise.com/videos/vscode-for-c-and-cpp)
In this blog post we will explore how to extend Visual Studio Code to improve our C++ development experience. We will be using the Microsoft C/C++ for Visual Studio Code (Preview) extension, the Arduino Extension for Visual Studio Code, and the PlatformIO IDE extension for Visual Studio Code.
This blog post assumes that you are familiar with Visual Studio Code and have a basic understanding of VSCode extensions. If you have never used VSCode before, I would recommend looking at the official documentation here. If you don’t know much about writing VSCode extensions, I would recommend reading the official documentation here.
Hello and welcome to my blog!
I’ve been using VSCode as my main editor for a couple of years now. I have been experimenting with extending it to make it more useful for my needs. I wanted to share what I did in case it can be useful to others as well. I’m mostly a C/C++ developer, so the extensions are mostly geared towards that, although some of them can be useful for other languages as well.
Some of the extensions are already available on the marketplace, and some are not (yet). In case an extension is not available, you can still download it from github and load it in VSCode.
The extensions were developed on Linux (Ubuntu 20.04), but they should work on Windows and MacOS as well (although they haven’t been tested there).
Recently, we added support for Microsoft’s Visual Studio Code to the Clangd language server. This is great news for C++ developers using VSCode, as it enables a first-class experience for C++ development in that editor. To show this off, I’ve created a video tour of VSCode’s C++ support in action:
In the video, you can see me editing and refactoring C++ code while getting helpful hints from Clangd. I also show how to use Clangd’s code completion feature, which provides context-aware suggestions for your code. This makes writing code much faster and easier. One of my favorite features is the new Find References command, which helps you understand how a symbol is used throughout your project. In addition to these features, Clangd understands your whole project so it can provide accurate diagnostics and navigation features such as Go to Definition and Peek Definition.
If you’re curious about the details of our extension, check out the README on GitHub. It has information about installing our extension and links to some useful documentation on how to set it up for your project.
If you run into any issues with the extension or have any questions about it, please let us know on GitHub or by leaving
Visual Studio Code is a cross-platform code editor developed by Microsoft. While it has its shortcomings, it’s pretty popular among developers. One of the reasons for its popularity is its extensibility which allows you to add support for new languages or debuggers, or even refactorings that all developers can benefit from.
As a C++ developer, you have a set of tools and frameworks at your disposal to help with your development process: static analysis tools like cppcheck and clang-tidy; unit testing frameworks like gtest and Catch; documentation generators like Doxygen; build systems like CMake, Bazel, Gradle and Meson; debugging tools like GDB, LLDB and WinDbg; coverage tools like gcov, lcov and bullseye; code formatting tools like clang-format and uncrustify; memory leak detectors like valgrind…
It’s easy to get lost in all the tools that are out there and trying to figure out how to best integrate them with Visual Studio Code can be challenging. In this blog post I’m going to show you how you can extend Visual Studio Code to compile and debug a simple C++ program using CMake and Google Test without ever leaving the editor.