Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-edits docs #899

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
76 changes: 76 additions & 0 deletions docs/cody/capabilities/auto-edits.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Auto-edits

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the doc, we can mention Auto-Edit (and not Auto-edits) as per the decision here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, Hitesh already caught it 👍


<p className="subtitle">Auto-edits suggests code changes by analyzing your cursor movements and typing. After you've made at least one character edit in your codebase, it begins proposing contextual modifications based on your cursor position and recent changes.</p>

<Callout type="info">Auto-edits is currently in the Experimental stage for all Cody users. Enterprise users can also use this, but with limited support. If you have feedback or questions, please visit our [support forum](https://community.sourcegraph.com/).</Callout>

## Capabilities of auto-edits

- Can automatically insert and delete text

- Can modify code before and after the cursor position

- Can handle complex refactoring operations like adding parameters and unpacking functions

- Works with repetitive tasks, especially in test files

- Can propose similar changes across multiple locations based on recent edits

## Enable auto-edits

Auto-edits is available exclusively for Pro and Enterprise users during the experimental release phase. Eligible Pro users will be gradually enrolled in the feature and will receive an in-editor notification when access is granted.

### Auto-edits access for Enterprise customers

**TBD -- waiting for Aravind to provide the details.**

## How do auto-edits work?

The system detects potential changes based on:

- Cursor placement in the code

- Recent changes made in similar contexts

- Function usage patterns

- Common refactoring patterns

## Auto-edits vs. Autocomplete

Autocomplete:

- Can only insert text, not delete

- Only proposes content after the cursor position

- Suggests on every character typed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point looks same as Requires typing to trigger suggestions should we only keep one of them.
Also, another major limitation of autocomplete is that it doesn't propose anything when there is existing content after the cursor (suffix), but there is no such limitation in auto-edit.

Also @valerybugakov to any more limitation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, our autocomplete implementation offers suggestions when we have only braces at the end of the current line but no other characters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only proposes content after the cursor position

There's also a limitation from the VS Code API: our autocomplete can only suggest content after the cursor position on the current line. So, if the model proposes an insertion into the middle or end of the following line, we don't have a way to render it. There's no such limitation for auto-edit.


Auto-edits:

- Can both insert and delete text

- Can modify code before and after the cursor position

- Proposes changes based on context and recent edits

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses a bunch of other context sources. I think we can highlight that recent edits is important but not the only context source.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses a bunch of other context sources.

Tell me :)


- Can do everything autocomplete can do

## Auto-edits use cases

1. Function signature refactoring (adding error returns)

2. Updating function call sites after signature changes

3. Repetitive modifications in test files

4. Parameter additions and function unpacking

5. Type system updates across multiple locations
jdorfman marked this conversation as resolved.
Show resolved Hide resolved

## Known limitations

- Requires at least one character edit in the codebase before suggestions become active
- May not propose all necessary changes in complex refactoring scenarios, requiring some manual edits
jdorfman marked this conversation as resolved.
Show resolved Hide resolved
- Sometimes requires manual deletion or cleanup of code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this isn't necessary. It's an inherent property of LLM-generated code these days.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 75 "- Sometimes requires manual deletion or cleanup of code" or all lines listed?

- Suggestions may not cover all similar instances of code that could be changed
Loading
Loading