-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68091e7
commit 58b5111
Showing
1 changed file
with
16 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,64 @@ | ||
# Auto-edit | ||
|
||
<p className="subtitle">Auto-edit 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> | ||
<p className="subtitle">Auto-edit suggests code changes by analyzing 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-edit 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> | ||
<Callout type="info">Auto-edit is currently available in VS Code extension in the Experimental stage for all Cody Pro users and Enterprise users on Cody Gateway (but with limited support).</Callout> | ||
|
||
## Capabilities of auto-edit | ||
|
||
- 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 | ||
- Can handle complex refactoring operations like adding parameters and unpacking functions | ||
|
||
## Enabling auto-edit | ||
|
||
Auto-edit 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. | ||
Eligible Cody Pro users will gradually be given access to the auto-edit feature. Once you have it, you will receive an in-editor notification. | ||
|
||
![Auto-edit demo](https://p21.p4.n0.cdn.zight.com/items/4guL2xzb/6d545dab-e2db-4114-a05e-c54b08e7f0bd.jpg?v=a3673b4b48aed41b1977858f18ba0369) | ||
|
||
🔴 **Image to be uploaded to GCP** 🔴 | ||
|
||
### Auto-edit access for Enterprise customers | ||
|
||
Auto-edit is available exclusively for Enterprise customers with [Sourcegraph Cody Gateway](/cody/core-concepts/cody-gateway#sourcegraph-cody-gateway) access. Enabling the feature requires two steps: | ||
Auto-edit is available for Enterprise customers with [Sourcegraph Cody Gateway](/cody/core-concepts/cody-gateway#sourcegraph-cody-gateway) access. Enabling the feature requires two steps: | ||
|
||
1. Site administrators must enable the feature flag `cody-autoedit-experiment-enabled-flag` | ||
1. Site administrators must enable the feature flag `cody-autoedit-experiment-enabled-flag` | ||
2. Once enabled, developers will receive a notification in their editor when the feature becomes available | ||
|
||
## How does auto-edit work? | ||
|
||
The system detects potential changes based on: | ||
The system detects potential changes based on the following: | ||
|
||
- Cursor placement in the code | ||
|
||
- Recent changes made in similar contexts | ||
|
||
- Function usage patterns | ||
|
||
- Common refactoring patterns | ||
|
||
## Auto-edit vs. Autocomplete | ||
|
||
Autocomplete: | ||
|
||
- Can only insert text, not delete | ||
|
||
- Only proposes content after the cursor position | ||
| **Feature** | **Autocomplete** | **Auto-edit** | | ||
| ---------------------- | -------------------------------------- | -------------------------------------------------- | | ||
| **Text modification** | Can only insert text, not delete | Can both insert and delete text | | ||
| **Cursor position** | Only proposes content after the cursor | Can modify code before and after the cursor | | ||
| **Suggestion trigger** | Suggests on every character typed | Proposes changes based on context and recent edits | | ||
| **Scope** | - | Can do everything autocomplete can do | | ||
|
||
- Suggests on every character typed | ||
## Use cases | ||
|
||
Auto-edit: | ||
|
||
- Can both insert and delete text | ||
|
||
- Can modify code before and after the cursor position | ||
|
||
- Proposes changes based on context and recent edits | ||
|
||
- Can do everything autocomplete can do | ||
|
||
## Auto-edit use cases | ||
The auto-edit feature can help you with various repetitive tasks in your code: | ||
|
||
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 | ||
|
||
## 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 | ||
- Suggestions are limited to a fixed number of lines around the cursor. | ||
- Suggestions are limited to a fixed number of lines around the cursor | ||
- Sometimes requires manual deletion or cleanup of code | ||
- Suggestions may not cover all similar instances of code that could be changed |