Skip to content

Commit 4cc73e9

Browse files
committed
Update after PM review
1 parent 21d39b6 commit 4cc73e9

6 files changed

+61
-27
lines changed

docs/copilot/copilot-edits.md

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ MetaSocialImage: images/shared/github-copilot-social.png
1010
---
1111
# Copilot Edits
1212

13-
Use Copilot Edits to start an AI-powered code editing session and iterate quickly on code changes across multiple files by using natural language. Copilot Edits applies the edits directly in the editor, where you can review them in-place, with the full context of the surrounding code. Copilot Edits brings the conversational flow of Copilot Chat and immediate feedback from Inline Chat together in one experience.
13+
Use Copilot Edits to start an AI-powered code editing session and iterate quickly on code changes across multiple files by using natural language. Copilot Edits applies the edits directly in the editor, where you can review them in-place, with the full context of the surrounding code.
1414

1515
Copilot Edits can function in two modes:
1616

1717
* [*Edit mode*](#use-edit-mode): select which files to edit, provide the relevant context and prompt, and Copilot will suggest code edits.
1818
* [*Agent mode*](#use-agent-mode-preview) (preview): let Copilot determine which files to edit and which commands to run. Copilot will autonomously use different [tools](#agent-mode-tools) to iterate and resolve issues to achieve the desired outcome.
1919

20+
> [!NOTE]
21+
> Agent mode is currently in preview and we continue to improve the experience. Provide feedback and report issues in the [Copilot repository](https://github.com/microsoft/vscode-copilot-release/issues).
22+
>
23+
> To enable agent mode, set the `setting(github.copilot.chat.agent.enabled)` setting to `true`.
24+
2025
The following video demonstrates how to use Copilot Edits to extend a basic Express app, such as adding a new page, navigation bar, and theme switcher.
2126

2227
<video src="images/copilot-edits/copilot-edits-hero.mp4" title="Use Copilot Edits to modify an Express app" loop controls muted></video>
@@ -46,17 +51,19 @@ Because making code changes can be an iterative process, an *edit session* in Co
4651

4752
In edit mode, you select which files to edit and provide the relevant context and prompt. Copilot will suggest code edits based on your prompt.
4853

49-
1. Open the Copilot Edits view
54+
1. Open the Copilot Edits view (`kb(workbench.action.chat.openEditSession)`)
5055

5156
1. Select **Edit** from the mode dropdown
5257

58+
![Screenshot showing the Copilot Edits view, highlighting edit mode selected.](images/copilot-edits/copilot-edits-edit-mode.png)
59+
5360
1. Use **Add Files** to add files to the _working set_
5461

5562
The working set indicates which files in the workspace can be edited by Copilot Edits.
5663

5764
1. Enter a prompt to request code edits. Be specific and precise about the changes you want, and decompose larger tasks into smaller tasks.
5865

59-
Copilot Edits streams the edits in the editor. In the working set, edited files are marked in bold.
66+
Copilot Edits streams the edits in the editor. In the working set, files that were edited by Copilot are marked in bold.
6067

6168
> [!TIP]
6269
> Add more specific context by using chat variables like `#file` or `#sym` to reference files or symbols. Use `#codebase` to let Copilot collect relevant context from your entire workspace.
@@ -69,38 +76,45 @@ In edit mode, you select which files to edit and provide the relevant context an
6976

7077
## Use agent mode (preview)
7178

72-
In agent mode, Copilot Edits operates in a more autonomous and dynamic manner to achieve the desired outcome:
79+
In agent mode, Copilot Edits operates in a more autonomous and dynamic manner to achieve the desired outcome. To process a request, Copilot loops over the following steps and iterates multiple times as needed:
7380

7481
* Creates a plan of action and decomposes the request into smaller tasks.
7582
* Determines the relevant context and files to edit autonomously.
7683
* Offers both code changes and terminal commands to complete the task. For example, Copilot might compile code, install packages, run tests, and more.
77-
* Monitors correctness of code edits and terminal command output and iterates to remediate issues.
78-
79-
Copilot Edits agent mode uses a set of [_tools_](#agent-mode-tools) to accomplish these tasks. For example, to determine which files to edit, gather project context, run terminal commands, read terminal output, and more.
84+
* Monitors the correctness of code edits and terminal command output and iterates to remediate issues.
8085

81-
To enable agent mode in Copilot Edits, set the `setting(github.copilot.chat.agent.enabled)` setting to `true`.
82-
83-
> [!NOTE]
84-
> Agent mode is currently in preview. The experience might change, and you might encounter issues. Provide feedback and report issues in the [Copilot repository](https://github.com/microsoft/vscode-copilot-release/issues).
86+
Copilot Edits agent mode uses a set of [_tools_](#agent-mode-tools) to accomplish these tasks. These tools can run in parallel to accomplish the requested task.
8587

8688
To use agent mode in Copilot Edits:
8789

88-
1. Open the Copilot Edits view
90+
1. Enable agent mode in by setting the `setting(github.copilot.chat.agent.enabled)` setting to `true`.
91+
92+
1. Open the Copilot Edits view (`kb(workbench.action.chat.openEditSession)`)
8993

9094
1. Select **Agent** from the mode dropdown
9195

96+
![Screenshot showing the Copilot Edits view, highlighting agent mode selected.](images/copilot-edits/copilot-edits-agent-mode.png)
97+
9298
1. Enter a prompt to request code edits.
9399

94-
In agent mode, Copilot Edits will determine the relevant context and files to edit autonomously.
100+
You don't have to specify the working set. In agent mode, Copilot Edits determines the relevant context and files to edit autonomously.
101+
102+
![Screenshot showing the Copilot Edits view, highlighting that Copilot searched the codebase for relevant files.](images/copilot-edits/copilot-edits-agent-search-codebase.png)
95103

96104
Copilot Edits streams the edits in the editor and updates the working set. In addition, Copilot can suggest terminal commands to run.
97105

98106
1. Review the suggested code edits, and confirm if Copilot can run the proposed terminal commands
99107

100-
You have to confirm the commands to run because they might result in changes to your project.
108+
As a user, you stay in control of the changes that are made to your project and can [review the generated edits](#accept-or-discard-edits) and need to confirm the terminal commands to run.
109+
110+
![Screenshot showing the Copilot Edits view, highlighting the terminal command that Copilot wants to run.](images/copilot-edits/copilot-edits-agent-confirm-command.png)
101111

102112
1. Copilot Edits detects issues and problems in code edits and terminal commands, and will iterate and perform additional actions to resolve them.
103113

114+
![Screenshot showing the Copilot Edits view, highlighting that Copilot verified the code edits for errors.](images/copilot-edits/copilot-edits-agent-check-errors.png)
115+
116+
1. Continue to ask follow-up questions and iterate on the code changes that Copilot Edits provides.
117+
104118
## Manage the working set
105119

106120
The _working set_ is the set of files that you want Copilot Edits to work on for your edit session. Copilot Edits does not make changes outside the working set, except when suggesting to create a new file. When you use agent mode, Copilot autonomously determines which files to edit and adds them to the working set.
@@ -197,18 +211,22 @@ After moving a chat request to Copilot Edits, the chat request is removed from t
197211

198212
## Agent mode tools
199213

200-
To complete a request, Copilot Edits uses a set of _tools_ to accomplish the individual tasks. The following list gives an overview of the built-in tools:
214+
To complete a request, Copilot Edits uses a set of _tools_ to accomplish the individual tasks. These tools can run in parallel to accomplish the requested task.
215+
216+
The following list gives an overview of the built-in tools:
217+
218+
* `search_codebase` - Search the workspace for relevant code or documentation
219+
* `file_search` - Search for files by glob patterns (for example, "**/*.js")
220+
* `grep_search` - Do a text search in files for exact strings or regex patterns
221+
* `read_file` - Read the contents of a file
222+
* `edit_file` - Edit a file in the workspace, changes can be [reviewed](#accept-or-discard-edits) like other edits
223+
* `list_dir` - List the contents of a directory
224+
* `run_in_terminal` - Run shell commands in a terminal (requires user confirmation)
225+
* `get_terminal_output` - Get output from a previously run terminal command
226+
* `get_errors` - Check for errors in code files and helps agent mode to self-correct code issues
227+
* `get_changed_files` - Get diffs of file changes
201228

202-
* search_codebase - Search the workspace for relevant code or documentation
203-
* file_search - Search for files by glob patterns (e.g., "**/*.js")
204-
* grep_search - Do a text search in files for exact strings or regex patterns
205-
* read_file - Read the contents of a file
206-
* edit_file - Edit a file in the workspace
207-
* list_dir - List the contents of a directory
208-
* run_in_terminal - Run shell commands in a terminal
209-
* get_terminal_output - Get output from a previously run terminal command
210-
* get_errors - Check for errors in code files
211-
* get_changed_files - Get diffs of file changes
229+
Agent mode gives you a more autonomous AI-powered editing experience, however you maintain control over the generated edits and terminal commands that are run.
212230

213231
## Settings
214232

@@ -280,11 +298,12 @@ You can drag and drop the Copilot Edits view into the Activity Bar to show it in
280298

281299
### Why would I use edit mode instead of agent mode?
282300

283-
Consider the following criteria
301+
Consider the following criteria to choose between edit mode and agent mode:
284302

285303
* **Edit scope**: you might use edit mode if your request involves only code edits and you know the precise scope and working set for the changes.
286304
* **Preview feature**: agent mode is still in preview and might not work for all scenarios.
287-
* **Response time**: agent mode involves more steps to process a request, so it might take longer to get a response. For example, to determine the relevant context and files to edit, determine the plan of action, and more.
305+
* **Duration**: agent mode involves multiple steps to process a request, so it might take longer to get a response. For example, to determine the relevant context and files to edit, determine the plan of action, and more.
306+
* **Non-deterministic**: agent mode evaluates the outcome of the generated edits and might iterate multiple times. As a result, agent mode can be more non-deterministic than edit mode.
288307
* **Request quota**: in agent mode, depending on the complexity of the task, one prompt might result in many requests to the backend.
289308

290309
## Related content
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)