Predicting your next edit

Matt Legrand, Head of Design, Augment Code
February 19, 20255 min read

Introducing Next Edit: AI that understands the ripple effect of code changes

avataravataravatar
Matt Legrand, Arun Chaganty, Jiayi Wei

Next Edit extends code completions beyond the cursor and across your entire workspace. It understands what you’re trying to accomplish and works in the background to suggest edits that help you complete your tasks more quickly and comprehensively.

The tedious game of find-and-replace

Every software engineer knows the pain: you update a field in one file, and now you’re hunting through the codebase updating SQL queries, tests, and type definitions to match. What should be a simple change becomes a tedious game of find-and-replace.

Next Edit is our solution to this problem. It extends code beyond the cursor by understanding the ripple effects of your changes and automatically suggesting updates across your entire workspace. While you code, it’s scanning your codebase, identifying dependent files, and generating contextual suggestions that keep your code in sync.

Next Edit is available to everyone using Visual Studio Code.

A motivating example: Adding a new field

Imagine you’re adding a new session_id field to an existing data class in your codebase. Traditionally, this would involve several manual steps:

  1. Updating the Data Class: First, you’ll need to add the new session_id field to your data class, placing it next to the existing request_id field.
  2. Propagating Changes: Then, you’ll need to update all direct usages of that data class throughout your codebase. This includes modifying function calls, adjusting method signatures, and updating any place where the data class is instantiated or manipulated.
  3. Updating Related Components: Beyond direct usages, you also need to modify relevant SQL queries, update protobuf messages, and adjust other related classes to incorporate the new session_id logic.

With Next Edit, as soon as you make the initial change to add the session_id field, Augment detects your intent and begins to suggest the necessary changes across your entire codebase.

Next Edit Workflow

Identifying and updating dependencies

Once you introduce the session_id field, Next Edit systematically analyzes your codebase to ensure consistency across all relevant areas:

  • Direct Usages: It identifies all the places where the data class is used and suggests edits to include the new session_id field.
  • SQL Queries: It locates relevant SQL queries that need updating and provides suggested edits.
  • Related Classes: It recognizes other classes and components that should incorporate the session_id logic, suggesting modifications to ensure consistency.
Next Edit Workflow

Ensuring test coverage

To maintain correctness and prevent regressions, Next Edit also updates relevant tests and protobuf usages, ensuring they align with the new session_id field.

Next Edit Workflow

Beyond refactoring: Supporting iterative development

In addition to refactoring, we’ve also found this feature to be incredibly helpful for developing new code, as you iterate over different draft versions. Whether you’re adjusting a function signature, renaming a variable, or refining logic, Next Edit automatically kicks in to update relevant parts of your codebase.

This allows you to focus on problem-solving rather than tedious updates—so your workflow matches the speed of your thinking, not just your typing.

Next Edit Workflow

How Next Edit is different

While Augment Next Edit and other features like Cursor Tab or GitHub Copilot Next Edit Suggestions all propose changes beyond the cursor, Next Edit stands out in a few key ways:

  • It relies on a specially trained location model and draws from your recent editing history to offer relevant suggestions—even in large files or across multiple files.
  • By contrast, other tools often require manually positioning the cursor to trigger edits.
  • Next Edit also leverages Augment’s incredible codebase retrieval, delivering more accurate and context-aware edits overall.

Example: Augment Next Edit vs. Cursor Tab

Augment Next Edit: Once session_id is added as a field in EditDatum, Next Edit finds and fixes all the changes in edit_dataset.py without the user needing to move their cursor to each relevant area!

Cursor Tab: Needs a lot more intervention to make the changes in edit_dataset.py and the user has to move their cursor to relevant parts of the code to get suggestions.

What’s next: Further opportunities to improve Next Edit

While we’re excited about what we’ve achieved with Next Edit, we’re committed to continuous improvement. Here’s what’s next:

Automating larger commits and PRs

We’re working on scaling up Next Edit to handle more substantial changes:

  • From Small Commits to Big PRs: Enhancing the model’s ability to understand broader contexts and dependencies will allow it to assist with larger pull requests and significant refactoring tasks.
  • Understanding Complex Dependencies: Improving the model’s capability to comprehend and navigate complex code dependencies across multiple files and modules.
  • Bulk Edit Support: Enabling the feature to suggest and apply changes across many files simultaneously and consistently, reducing the time spent on repetitive tasks.

Better integration with other features like Chat

Integrating Next Edit with our chat functionality opens up new possibilities:

  • Enhanced Contextual Understanding: Chat can provide additional context to make next edit suggestions more precise, especially when multiple potential edits are possible.
  • Interactive Problem Solving: Developers can use chat to ask for explanations, request alternative solutions, or clarify the intent behind suggestions.
  • Cohesive Development Environment: Combining these features creates a more intelligent and supportive environment, further reducing friction and enhancing productivity.

Building Next Edit was a challenging but rewarding journey. We tackled complex AI problems to create a feature that understands your intent, knows where to apply changes, and executes those changes accurately and efficiently.

By leveraging our advanced retrieval infrastructure, novel modeling techniques, and a deep understanding of developer workflows, we’ve created a tool that keeps you in the flow, reduces manual toil, and accelerates your coding process.