Skip to content

Commit af559eb

Browse files
MaedahBatooljdorfmanvalerybugakovaramaraju
authored
Auto-edit docs (#899)
Docs for auto-edit - Preview: https://sourcegraph-docs-git-auto-edits-docs-sourcegraph-f8c71130.vercel.app/docs/cody/capabilities/auto-edit --------- Co-authored-by: Justin Dorfman <[email protected]> Co-authored-by: Justin Dorfman <[email protected]> Co-authored-by: Valery Bugakov <[email protected]> Co-authored-by: Aravind Ramaraju <[email protected]>
1 parent f3dd7a5 commit af559eb

File tree

3 files changed

+7007
-7887
lines changed

3 files changed

+7007
-7887
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Auto-edit
2+
3+
<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>
4+
5+
<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.</Callout>
6+
7+
## Capabilities of auto-edit
8+
9+
- Can automatically insert and delete text
10+
- Can modify code before and after the cursor position
11+
- Works with repetitive tasks, especially in test files
12+
- Can propose similar changes across multiple locations based on recent edits
13+
- Can handle complex refactoring operations like adding parameters and unpacking functions
14+
15+
## Enabling auto-edit
16+
17+
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.
18+
19+
<video width="100%" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
20+
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/auto-edit-in-action-2025.mp4" type="video/mp4" />
21+
</video>
22+
23+
### Auto-edit access for Enterprise customers
24+
25+
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:
26+
27+
1. Site administrators must:
28+
- Enable the feature flag `cody-autoedit-experiment-enabled-flag`
29+
- Add `fireworks::*` as an [allowed provider](https://sourcegraph.com/docs/cody/enterprise/model-configuration#model-filters) (see below)
30+
2. Once enabled, developers will receive a notification in their editor to turn it on
31+
32+
The following example demonstrates how to add Fireworks as an allowed LLM provider:
33+
34+
```json
35+
36+
"cody.enabled": true,
37+
"modelConfiguration": {
38+
"sourcegraph": {
39+
"modelFilters": {
40+
// Only allow "beta" and "stable" models.
41+
// Not "experimental" or "deprecated".
42+
"statusFilter": ["beta", "stable"],
43+
44+
// Allow any models provided by Anthropic, OpenAI, Google and Fireworks.
45+
"allow": [
46+
"anthropic::*", // Anthropic models
47+
"openai::*", // OpenAI models
48+
"google::*", // Google Gemini models
49+
"fireworks::*", // Open source models hosted by Sourcegraph
50+
],
51+
}
52+
}
53+
}
54+
```
55+
56+
## How does auto-edit work?
57+
58+
The system detects potential changes based on the following:
59+
60+
- Cursor placement in the code
61+
- Recent changes made in similar contexts
62+
- Function usage patterns
63+
- Common refactoring patterns
64+
65+
## Auto-edit vs. Autocomplete
66+
67+
In terms of feature-set and functionality, auto-edit and autocomplete have some key differences:
68+
69+
| **Feature** | **Autocomplete** | **Auto-edit** |
70+
| ---------------------- | -------------------------------------- | -------------------------------------------------- |
71+
| **Text modification** | Can only insert text, not delete | Can both insert and delete text |
72+
| **Cursor position** | Only proposes content after the cursor | Can modify code before and after the cursor |
73+
| **Suggestion trigger** | Suggests on every character typed | Proposes changes based on context and recent edits |
74+
75+
## Use cases
76+
77+
The auto-edit feature can help you with various repetitive tasks in your code:
78+
79+
- **Function signature refactoring**: Automatically suggests adding error returns, new parameters, or changing return types across function definitions. For example, when you modify a function to return both a value and an error, auto-edit helps update the function signature.
80+
- **Call site updates**: When you change a function's signature, auto-edit detects all locations where the function is called and suggests necessary modifications to match the new signature. This includes updating parameter orders, adding error handling, and adjusting return value usage.
81+
- **Test file maintenance**: Helps with repetitive updates in test files, such as modifying test assertions, updating mock objects, or changing test data structures. Auto-edit recognizes patterns from your recent changes and suggests similar modifications across related tests.
82+
- **Parameter refactoring**: Assists in adding, removing, or reorganizing function parameters. When you unpack a function to handle more cases, auto-edit helps restructure the parameter list and suggests corresponding changes at call sites.
83+
- **Type system modifications**: When updating type definitions or interfaces, auto-edit identifies and suggests consistent changes across your codebase. This includes updating variable declarations, function parameters, and return types to maintain type consistency.

0 commit comments

Comments
 (0)