Next Edit Suggestions Now Available in Visual Studio with GitHub Copilot
Authored by Simona Liao, this article details the launch of Next Edit Suggestions in Visual Studio, an AI-powered Copilot feature that enhances code editing and refactoring workflows.
Next Edit Suggestions Now Available in Visual Studio with GitHub Copilot
By Simona Liao
GitHub Copilot is well-known for its code completions (those familiar ‘gray text’ suggestions) that help autocomplete unfinished code and offer helpful templates. However, code writing is only part of development—editing and refactoring are equally crucial. What if Copilot could support these activities too?
We are excited to announce Next Edit Suggestions (NES), now available in Visual Studio 2022 17.14. NES leverages your previous code edits to predict your next likely changes—be those insertions, deletions, or a mix. Unlike traditional Copilot completions, which are limited to your caret position, NES proactively surfaces suggestions anywhere in your file, pointing you to the most probable next edit.
Example Usage Scenarios
Next Edit Suggestions are helpful in several scenarios. They go beyond repetitive tasks such as renaming by making logical code changes—like updating when you add new variables or alter a method’s purpose. Here are some examples:
1. Refactoring a 2D Point Class to 3D Point
- NES recognizes a pattern and suggests changes across the class as you refactor from 2D to 3D.
- View demo video
2. Updating Code Syntax to Modern C++ (Using STL)
- NES can update not just
printf()
tostd::cout
but also handles other syntax, such as refactoringfgets()
. - View demo video
3. Making Logical Changes After Adding New Variables
- NES quickly adapts when a new variable is added, updating logic consistently throughout the code.
- View demo video
Getting Started with Next Edit Suggestions
To enable NES:
- Go to Tools > Options > GitHub > Copilot > Copilot Completions > Enable Next Edit Suggestions in Visual Studio 2022 17.14.
- Once enabled, NES works as you code. When a suggestion is ready, it appears in a diff view:
- Red highlights original code.
- Green shows Copilot’s suggested changes.
If NES finds an edit on a different line, a navigation hint appears:
- The hint bar indicates you should press Tab to jump to the line containing the suggestion.
- An arrow in the gutter shows edit location.
- After landing on the edit line, Tab accepts the suggestion.
Once on the intended line:
- The gutter arrow changes color.
- The hint bar recommends Tab to Accept.
Mouse Interaction
- An arrow in the gutter signals edit suggestions.
- Clicking it brings up a menu: Navigate to, Accept, or Dismiss the suggestion.
See NES step-by-step in the demo videos above.
Feedback & Community
Try Next Edit Suggestions in Visual Studio today to see how it streamlines your logical code edits and refactoring. The development team is eager for your feedback—please share your thoughts or issues via the Developer Community to help improve NES.
Visual Studio Hub
For the latest on Visual Studio—including release notes, educational videos, social media updates, and discussions—visit the Visual Studio Hub.
Appreciating Developer Feedback
Your insights continue to make Visual Studio the tool it is today. The team is grateful for your feedback and encourages ongoing contributions through Developer Community.
This post appeared first on “Microsoft DevBlog”. Read the entire article here