 Hi everyone. My name is Julia. I'm a program manager on the Visual C++ team at Microsoft. I focus specifically on the VS Code C++ extension. Thank you for joining my session today. I'm really excited to talk about how to use VS Code for C++ development. So let's go ahead and get started. So I'll start by going over the topics that I'm going to talk about today. One thing is I want to show you the things that you can do with VS Code. The beauty of VS Code is that you can customize it to use it however you'd like, whether that is strictly as a lightweight text editor or as a full IDE with build and debug support. There are also a bunch of non-C++ specific features that VS Code has, such as the remote development extensions and the live share extensions. So I'm going to talk a little bit about those today as well. I will also talk about which tools we recommend for cross-platform development in VS Code. Cross-platform development is a super popular scenario these days, and VS Code is a great option for that because it can be run on Linux, Windows, and macOS. I will also talk about VC Package today, which is an open-source cross-platform C++ package manager. It is consistently reported that package management is a huge pain point for C++ developers. We see this in the SAC overflow survey results, the ISOCVP survey results, and more. So I want to show you how you can use VC Package to make managing your project dependencies easier across all platforms. VC Package also can be integrated with VS Code, which we will go over in the demo. This part of the demo also includes a preview of an exciting new feature. It has not officially been released yet, so I'm going to show you what we have in the works, and you can get a feel of what's coming next with VC Package and some enhancements you can expect to see in the near future. So let's talk about the things that you can do with VS Code. As I mentioned, it's up to you how extensive you want your VS Code experience to be. If you prefer to use it strictly as a lightweight text editor and take care of your building and debugging outside of VS Code, that works. If you would like to use it as a full IDE, it can do that too. VS Code has great C++ language support. It has IntelliSense, code completion, a bunch of productivity features such as find all references, rename, go to definition, and more. You can build and debug your C++ projects in VS Code. It will find whichever compiler or debugger you have installed on your machine. We also have native CMake project support in VS Code as we recently started maintaining the CMake tools extension. CMake is one of the most popular build systems for C++ projects, especially for open source projects, and the CMake tools extension makes it super easy to configure CMake projects in VS Code. VS Code has great remote development extensions as well. This includes the SSH extension, the containers extension, and the WSL extension, which is Windows subsystem for Linux. Finally, I'll talk about the collaborative development features of VS Code. VS Code has a live share extension pack which enables you to start a collaborative session from VS Code, share the URL to that session with anyone that you trust, and then they can join that session from their instance of VS Code on their machine and you can work together. You can even do a collaborative debugging session. Alright, so for my demos today, I'm going to use the SuperTux project. It is an open source, classic 2D game. You can clone the repository, which is what I did. SuperTux has a great community of developers that contribute new levels to the game. It's a great open source project for demos because it is cross-platform. Alright, let's get started. Alright, so I have my SuperTux project open in VS Code on my laptop right now, and I'm going to show you some of the cool C++ language features that we have in VS Code. So let's start with the find all references. I want to find all references of this mState variable here in my bad guy header file. So I can just do right-click and then select find all references, or you can do shift out F12 if you prefer to use the keyboard shortcut. And this will find both confirmed and not confirmed references for this variable. So a confirmed reference means it's not only a text match, it's also a semantic match. And non-confirmed references mean it's a text match, but it might not be a semantic match. It could be in a comment, in a string, in an inactive code block, etc. So here you can see in this references pane on the left, in the top section, these are all of my confirmed results. And down here, these are other references results that cannot be confirmed. So now let's do a rename. So let's say I want to rename this variable to xState. So I can again do a right-click and then select rename symbol from the context menu, or I can simply click F2, which will prompt me to rename the variable. Alright, so I'm going to type in xState, but I want to preview all of these changes before committing them. So I'm going to do shift and dirt preview. And again, this is doing a find all references before showing me the references that will be renamed. Cool. So in this refactor preview tab, I can look at all of the references that are candidates for my rename. And select which ones I want to include or exclude in my changes. So let's go ahead and go through these. And then once you feel good about the changes that you are committing, you can just select this check mark right here to apply refactoring. Alright, so now I'll show you go to definition, go back to my files. Alright, so let's say I want to know where this set flip function is defined. So I will do a right-click and select go to definition, or you can just do F12 for the keyboard shortcut. And you can also go to declaration, so I will show you that as well. And this should take me to the header file. There we go. It's also worth calling out that if you want to see the definition or the declaration, but you don't want to actually navigate to a new file, then you can use the peak capability by doing control click, selecting peak from the context menu, and then let's do peak definition. There we go. So this gives me a little preview of where this is defined without actually taking me to that file. So now that you've seen some of the core C++ language features in VS Code, let's talk a bit about cross-platform development. Cross-platform development is super popular these days. We see in a lot of survey feedback that people are developing for more than one platform. They are developing for a platform that is different from their host OS. And VS Code is a great option for both of those scenarios. It runs on Linux, Windows, and Mac OS, as I mentioned before. It has native support for CMake, and CMake is a cross-platform meta-build system. And because VS Code has such great support for CMake projects, you can have your CMake project as a cross-platform project and configure on VS Code regardless of what OS you're using. VS Code also integrates well with VC package, and VC package works across all platforms as well. So if you're using CMake and you're using VC package in your project, that sets you up to be able to configure your project easily in VS Code across Windows, Linux, and Mac. Also, VS Code enables targeting different platforms through remote development extensions. I briefly mentioned these before, but there's the SSH extension, the containers extension, and the Windows subsystem for Linux extension. In today's demo, I'm going to show you how to use the CMake tools extension to configure, build, and debug your CMake projects. I will show you how I've integrated VC package with CMake tools extension to manage all of SuperTux's dependencies. And I will then use the remote SSH extension to SSH into my Linux VM and show you that we can configure everything following the same exact steps on Linux, and it just works. It'll use GCC and GDB, but all of the steps that you'll take to configure and build your project are exactly the same. The CMake tools extension makes it very easy to configure CMake projects in VS Code. You can create a new CMake project from scratch, you can turn an existing project into a CMake project, or you can configure an existing CMake project. In other words, if your project doesn't already have a CMakeList.txt, this extension will create one for you. And if it does have one, the extension will find it and use it. So this project, SuperTux, already has a CMakeList.txt. So let's just go ahead and start configuring the project. There are two things that we need to do to configure this project using CMake tools. The first is select a kit. A kit contains the project agnostic configuration agnostic build instructions for your code, such as the name of the compiler that you're using. So at the bottom of the screen in the blue status bar, you'll see the no active kit button. I can go ahead and click that and I see an option of kits that I can use. The first time you do this, you'll have to click scan for kits, which will search for compilers on your computer. It'll search the path environment variable. It'll look for visual studio instances. If for some reason after scanning for kits, the compiler you want to use is not showing up, you can actually edit this CMakeKits.json file directly and add it yourself. So I've already scanned for kits, which is why you see a list of compilers on my computer. So I'm going to select the one that I want to use. You can see it's loading the kit. Great, it's loaded. The second thing I need to do is select a variant. These are instructions for how to build the project. So by default, CMake Tools extension will show you four variants that you can use, each corresponding to a default build type. If I click right here, we can see what they are. So I'm going to select debug. And now it is configuring my project. All right, so now that our project has been successfully configured, our build files have been written to this new build folder in our project directory. So right here, SuperTux build, you can see it in the left build folder. And these are the files that CMake Tools generated for us. So now we can go ahead and build our project. So one thing we can do is select which targets we'd like to build. So if we select this button here at the bottom that says all, you'll see a list of targets. I'm going to select all. So we can go ahead and build by just clicking that command in the blue status bar. It's also worth calling out that all of these commands in the blue status bar that are provided by the CMake Tools extension can be invoked from the command palette. So if you just do control shift P to open the command palette and then type CMake, you'll see all of the CMake Tools extension commands right here. All right, so we have a successful build. Now we can debug. So you see I set a break point in the main dot CPP file. And down here at the bottom, we can select the target to launch, which we have as SuperTux too. And we can just click debug and it'll start the debugger. We can also click on the CMake tab on the left and you'll see your CMake target here as well SuperTux too. And you can right click and select debug from this context menu as well. All right, so now we have launched the debugger and you can see it's stopping at the break point that I set. And on the left in the debugger panel, we show the values of local variables, registers. You can add a watch variable, which is a variable whose value you want to watch change over time. We show the call stack and the list of break points. So you can disable break points directly from here. You can add a new break point, type the name of the function you want to break at. And there you go. So I'm going to disable this break point. I'm going to continue stepping over and finish running the program and our SuperTux GUI should launch. And there it is. We'll just take a moment. All right, so there we have our game. So we just successfully built and run SuperTux and VS Code using the CMakeTools extension. And those are the general steps for configuring a CMake project in VS Code. So now let's take it one step further and look at how we integrated VC package with CMakeTools to manage all of SuperTux's dependencies. So first I'll give you a little bit of information about VC package. VC package is a cross-platform command line package manager for C++. There are over 1,300 libraries supported in the VC package catalog across Windows, Mac, and Linux. It is open source and there are a bunch of benefits to using VC package to manage your C++ packages. First is it simplifies the acquisition and installation of third-party libraries. All you need to do is run VC package install and then the name of the library from the command line. So the libraries are all routinely tested against each other for compatibility to ensure a high-quality catalog. The last thing I'll mention is that you can integrate CMake with VC package so that CMake can find all packages that were installed through that instance of VC package when configuring and building your project. Installing VC package is very simple and it is the same experience on Linux, Mac, and Windows. The first thing you'll do is clone the GitHub repository and see the link in the slide. Then you run the bootstrapper in the VC package root folder. And finally, you can run VC package integrate install to integrate VC package with Visual Studio and VS Code. So let's take a look at how this works with SuperTux. Alright, so as I mentioned in the slides, once you clone the VC package GitHub repository and bootstrap it, you can run VC package integrate install to integrate VC package with VS Code. So let me show you what that looks like. In my terminal, I'm going to navigate to the instance of VC package that I'd like to use and I'm going to run VC package integrate install. So now this integrates VC package, this specific instance of VC package with VS Code so that VS Code can use it for configuring Intellisense for source files. It also tells you what you need to set the CMake toolchain file path to be such that CMake can find the packages installed with this instance of VC package by invoking the find packages command. So in order to hook this up with the CMake tools extension, we just need to edit the CMake toolchain file property for the CMake tools extension and we can do that in the workspace settings JSON. So the workspace settings JSON lives in the .vscode folder for your project. If you don't see it, that just means you haven't configured any workspace specific settings yet and you can get there from the command palette. So you control shift P, typing preferences, open workspace settings. So this opens a UI where you can edit settings for your workspace. You can also edit settings at the user level and you can edit settings specific to the extensions that you're using. So we're interested in the CMake tools configuration settings. So some of these settings you can edit directly in the UI. Others you'll see it'll tell you to edit and settings JSON. So that's what we did in order to set the CMake toolchain file path. So I can show you that. Here we go. CMake configure settings. So I just clicked edit and settings JSON and it created this CMake configure settings object. Whereas I specified the CMake toolchain file path and I added the VC package build property and marked it as on. So how VC package works today is customers have to manually install all of their project dependencies using VC package and configure them so that CMake can find them. We're working on a new feature, which we are very excited about. And it has not officially been released yet, but I'm going to demo what we currently have in the works right now so you can get a feel of where VC package is heading and some enhancements that are coming soon. So this new feature is a manifest file and in your project folder. So VC package.json file that lists all of your project dependencies and then VC package will detect that VC package JSON file and take care of installing all of the listed dependencies any dependencies that those libraries have and configuring them so that CMake can find them all automatically. And I'll show you what that looks like. So we have this VC package JSON file for SuperTux. So these are all of the dependencies that SuperTux has. And so yeah, as VC package six today, you would have to go in and manually install these VC package install each of these packages. But the new experience is that from your project directory. So let me navigate to my project directory. I can call VC package. So install my triplet as X64 windows specify binary caching. So what this will do is it'll find that VC package JSON file that manifest file in my SuperTux project. And it will go ahead and install all of these dependencies if they're not already installed and configure them so that CMake can find these packages. So let's click enter. There we go. So all of these packages were already installed, which is why I was able to successfully configure and build the project earlier on in the demo. But just to show you how this works, let's add in another item to our dependencies list that I don't already have installed. Okay, so now if we run this command again, there we see that it builds the FMT package and it's using the cached binary package, which makes it faster and installed it. And yeah, it's as easy as that. So this is a really great new feature that we're excited about because it makes it really easy to just share this manifest file in your project. And then anyone who's using this project can just run the VC package command from their command line and it will take care of installing all of the dependencies and configuring them with CMake. It's a very automated seamless experience and we're very excited about it. So I want to reiterate that one of the benefits of using VS Code and CMake and VC package is that it allows you to configure your project in a way that switching to a different platform is seamless. All of these tools work across Windows, Linux, and Mac. So I just showed you how it works on Windows. Now I'm going to use the VS Code remote SSH extension to SSH into my Linux via and show you that it works the same on Linux. I'm going to show you how to use the remote SSH extension in VS Code to connect to a Linux VM. So the first thing you'll have to do is install the remote SSH extension from the extension marketplace. Once you do that, then you'll see this Remote Explorer icon on the left. So if I click on that, then I'm presented with a list of SSH targets that I have previously connected to through this remote SSH extension. In this dropdown, I can select between SSH, WSL, VS Online, Containers. These are all different remote extensions in VS Code. And if you download the remote extension pack, then it will include all of these extensions with it. So I'm going to connect to this host right here. I could also add a new one by clicking on this plus sign. But this one down here, this is where my SuperTux project is. So let's open a new window. And you can tell that you are in your remote window based off of this SSH target IP address in the bottom green corner. All right, so let's open a folder. And it's important to call out that the remote SSH extension in VS Code works differently than remote development in Visual Studio because all of my source files are already on my Linux VM. Nothing is copied over from my Windows laptop. So before this demo, I had connected to the Linux VM and cloned the SuperTux GitHub repository. So let's open that. There we go. And you can see that IntelliSense is working properly on my Linux VM. So we can start by making sure that all of the project dependencies are installed on this VM by running the VC package install command. It has the VC package JSON manifest file right here. Let's solve the dependencies. So all we need to do is run this command VC package install binary caching from my project folder. And there we go. All of these packages are installed. So then we can just follow the same steps to configure the project using CMake tools. You'll notice that when I select a kit, these are all compilers that are found on my Linux VM. So this time I am using GCC. So let's configure and then we can build and we can debug. And this time it'll use GDB, which you can see right there executing GDB. All right. So there we have it. It's all working properly on Linux, followed the same exact steps that I did on Windows, except that it's using GCC and GDB under the hood. So now you've seen how to successfully use VS Code, the CMake tools extension and VC package to configure our SuperTux CMake project on all platforms. The takeaways from this demo are that VS Code CMake tools extension and VC package are all tools that we recommend to ease your cross platform development experiences. Additionally, you should use the VS Code remote extensions if you would like to develop for platforms other than your host OS. So now I'm going to dive into how VS Code can be used for collaborative development. VS Code has a live share extension pack, which enables you to start live collaboration sessions directly in VS Code directly in that text editor. So it makes it really easy for you and your teammate to quickly collaborate on the same code base because you don't have to worry about replicating code or adjusting configuration or environment settings. What happens is that your teammate actually sees a context of your workspace in their editor. And they get all of the language features such as intelligence and go to definition, rename, and so on. So once you are both in the same collaborative session, you can both open files and navigate through the code, make changes, and these changes will be reflected in real time for both of you. And you can even do collaborative debugging sessions so that you can both independently use the debugger features such as setting breakpoints or watching local variables. So now I will give you a little demo of how the live share extension works. It's worth calling out that normally it wouldn't be the same person joining the session from their computer and their VM. You would use this with a co-worker or a class member or anyone that you trust, but it could be any two machines, right? So in this demo I will be using both of the machines, but if you're using this extension it would likely be your computer and someone else's computer. So on my Windows laptop, I'm going to start my collaboration session. And before recording this demo, all I did was install the live share extension pack on both my laptop and my VM. If the extension pack has any OS specific dependencies that aren't already installed on your machine, VS code will let you know and will give you the option to let it just install those for you and take care of everything. So on my Windows laptop, I will click on this live share icon on the left to open this live share pane. And then I can click start collaboration session and this will give me a URL that I can share with whoever I want. And by using that URL they can join the session from their own device. Alright, so the invitation link has been copied to my clipboard. So now I'm going to go into my VM and in the same live share pane on the left I'm going to click join collaboration session and then paste the URL for the session that I just started. Okay, so this is just joining the live share session from my VM. It might take a moment since I'm doing this remotely. There we go. So now you can see in my Explorer on the Linux VM, I have this Visual Studio live share workspace. And it is loading the SuperTux project from the collaborative session that I started on my Windows laptop. So now I can actually see the cursor of where the other person in the collaborative session is. And if I highlight something, it will show up on that other person's screen. They'll be able to see how I'm interacting with the code. Let's say we want to debug something together. I can start a debugging session. So let's do that. I have my breakpoint set in main. We'll click debug. And you can see it launched the debugger in both my Windows laptop and my Linux VM. So here I can debug with my co-worker directly from my own instance of VS Code. As we wrap up our session today, I want to talk a little bit about what's coming next for VC package and for the C++ extension in VS Code. So there are a few enhancements that we're currently working on for VC package. The first is support for a manifest file, which is the VC package.json that I demoed for you today. We're also working on a first class experience for managing private libraries with VC package. Customers will also be able to bring in additional libraries outside of what's supported in the catalog. VC package will use binaries to update rather than pulling from source every time. And we also will support versioning, which means you can specify exactly which version of a package you would like to use. So if your project has a dependency on an older version of a package, that's fine, you'll be able to use that. As for the C++ extension, we're currently working on support for Linux on ARM and ARM64 devices. We'll start by releasing IntelliSense modes for cross-compiling, and then we'll have the full remote development and debugging on ARM experience. If you are interested in when these features are being released, you can stay tuned to the C++ team blog. As I said, these are things that we are currently working on and planning for, so I don't have specific dates to give you today. So the best thing you can do is just check the C++ team blog for announcements of new features. And that is the link to the blog in the slide. Also, please give us your feedback. The C++ extension, the CMake tools extension, and VC package are all open source, which means you can find all of their repos on GitHub. We turn to our GitHub repositories frequently when we are creating our roadmaps for new features. We check out the open issues pages on each of these repos and see which open issues have the most upvotes. And that tells us what our customers care most about. So I have the links to the GitHub repos on the slide. Please, if you have a bug or an issue, check out the issues page and create an issue if you don't already see the one that you're looking for. Upvote feature asks that you care about so we know what to prioritize. And of course, feel free to contribute to the repositories yourself. We are always looking for contributors. Alright, well thank you for coming to my session and I'm excited to answer your questions in the live Q&A.