When working in a C++ repo, you often are maintaining and updating existing code just as often as you are writing new code. However, updating code in C++ can often require navigating to several different locations in a file to ensure consistency, which can disrupt your logical workflow. For example, changing a data member’s access level typically involves several steps: moving the member between the public
and private
sections of the class, adding getter/setter methods, and updating all references to respect this new access level.
GitHub Copilot now supports Next Edit Suggestions (or NES for short) to predict the next edits to come. NES in GitHub Copilot helps you stay in flow by not only helping predict where you’ll need to make updates, but also what you’ll need to change next.
Example: Converting C code to C++
At Microsoft Build, we showed how NES can dynamically update C++ code, including an example of updating code syntax that was using C functions to use the C++ Standard Template Library (STL).
For example, when updating code that reads from stdin from C-style code that uses raw character arrays to C++ code that uses the std::string
type, NES predicts and suggests updates across all applicable areas near the cursor. NES replaces calls to fgets
with calls to std::getline
and replaces atoi
with the C++ std::stoi
, which has better error handling.
You can then review and make any relevant updates – for example, in this case, any other areas that call on strings.
Next Edit Suggestions is now available in both Visual Studio and VS Code. As you try out NES, we’d love to hear your feedback. Share your feedback on Developer Community for Visual Studio or on GitHub for VS Code to help shape what’s next and how we can improve. If NES streamlines your workflow or saves you time, let us know – drop a comment or email us at visualcpp@microsoft.com. We’re excited to see how you’re using NES for C++!
Agent Mode and other new Copilot features
GitHub Copilot is evolving beyond typical code completion, with features like Next Edit Suggestions, Agent Mode, and MCP transforming how developers interact with AI. The Visual Studio session at Build not only showcased NES in action, but also Agent Mode and MCP and how they each revolutionize the traditional Copilot interfaces. While NES predicts your next code edits in the editor, agent mode can work as an iterative AI assistant that understands your intent to provide dynamic edits and information.
To learn more about the C++ NES use cases detailed above and these other new features available for developers in Visual Studio, watch “Top GitHub Copilot features you missed in Visual Studio 2022”.
What do you think?
Try out the latest Copilot features for your C++ workflows today. To access these updates to Copilot, you’ll need an active GitHub Copilot subscription and the latest version of Visual Studio.
Our team is working hard on improving C++ integrations with Copilot, so please let us know any other enhancements you’d like to see. Share your thoughts with us on Developer Community for Visual Studio or on GitHub for VS Code to help shape what’s next and how we can improve. You can also reach us via email at visualcpp@microsoft.com, via X at @VisualC, or via Bluesky at @msftcpp.bsky.social.
0 comments
Be the first to start the discussion.