Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Next edit suggestions use recent edits you make to anticipate the next edit you might want to make, and the ___location of that edit. With this new ability, GitHub Copilot suggests revisions to your code, comments, tests, and more.
Inline completions are great at autocompleting a section of code. Copilot NES helps you stay in the logical edit flow, suggesting changes relevant to your current work, and you can simply Tab
to quickly navigate and accept Copilot's suggestions. Suggestions may span a single symbol, an entire line, or multiple lines, depending on the scope of the potential change.
Prerequisites
To get started, you need:
- Visual Studio 2022 version 17.14 or later
- Sign in to Visual Studio using a GitHub account with Copilot access
** You can use GitHub Copilot for Free. Sign up and leverage AI to code faster and more efficiently.
Get started with NES
To get started with Copilot NES, enable the feature in Tools > Options > GitHub > Copilot > Copilot Completions > Enable Next Edit Suggestions.
Use next edit suggestions
To start getting suggestions from NES, start coding. When Copilot suggests code edits, you can navigate to it with the Tab
key, and then accept it with the Tab
key again. You save time by quickly jumping to the next relevant edit, without needing to manually search through files or references yourself. An arrow in the gutter indicates whether an edit suggestion is available.
An arrow in the gutter indicates if there is an edit suggestion available. Click the arrow to explore the edit suggestion menu, which includes keyboard shortcuts.
If an edit suggestion is below the current editor view, the arrow points down instead of right. Scroll past an edit suggestion and the arrow hints the ___location of the next edit suggestion, pointing up or down based on where you're in the file.
Use cases for Next Edit Suggestions
NES is helpful in various scenarios, not only making obvious repetitive changes, but also logical changes. Here are some examples:
Catch and correct mistakes
NES helps with mistakes like typos, for example, if you wrote
bol
instead ofbool
.Copilot can also help with more challenging mistakes in logic, like an inverted ternary expression or a comparison that should use
||
instead of&&
.
Change in intent
NES suggests changes to the rest of your code that match a change in intent. For example, when refactoring a Point
class to Point3D
.
Update code syntax
NES helps with repetitive changes, such as updating code syntax to modern C++ using the Standard Library (STL). For example, when updating all printf()
to std::cout
, also update other syntax such as fgets()
.
Refactor
Rename a variable once in a file, and NES will suggest updating it throughout the file. If you introduce a new name or naming pattern, Copilot suggests updates to subsequent code to match.
Match code style. After you paste some code, NES suggests adjustments to match it with the style of the surrounding code.