Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/copilot/chat/review-code-edits.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ If you automatically accept all edits, it's strongly recommended to still review

## Edit sensitive files

To prevent inadvertent edits to sensitive files, such as workspace configuration settings or environment settings, VS Code prompts you to approve edits before they are applied. In chat, you can see a diff view of the proposed changes and choose to approve or reject them.
By default, VS Code automatically applies edits to files in your workspace and then prompts you to approve these edits before they are finalized.

Use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval. The setting uses glob patterns to match file paths in your workspace.
To prevent inadvertent changes to _sensitive files_, VS Code can show a diff view of the proposed edits before they are applied. You can then decide if you want to keep or reject these edits. Use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval from chat.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To prevent inadvertent changes to _sensitive files_, VS Code can show a diff view of the proposed edits before they are applied. You can then decide if you want to keep or reject these edits. Use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval from chat.
To prevent inadvertent changes to _sensitive files_, VS Code can show a diff view of the proposed edits before they are applied. You can then decide if you want to keep or reject these edits. Use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval from chat. The setting uses glob patterns to match file paths in your workspace.

Copy link
Author

Choose a reason for hiding this comment

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

This part (lines 43-45) appears redundant to the next part below (lines 47 to 50) if I am not misunderstanding what is being proposed now.


By default, VS Code asks for approval for workspace configuration settings, environment settings, and a limited set of known files. It is recommended to review the list of file types and add sensitive files for your project.


If you wish to see a diff view of proposed changes in chat _before_ the edits are made and choose to approve or reject them from chat first, use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval from chat. The setting uses glob patterns to match file paths in your workspace. The default is to _not_ show most diffs in chat first.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you wish to see a diff view of proposed changes in chat _before_ the edits are made and choose to approve or reject them from chat first, use the `setting(chat.tools.edits.autoApprove)` setting to configure which files require approval from chat. The setting uses glob patterns to match file paths in your workspace. The default is to _not_ show most diffs in chat first.

Copy link
Author

Choose a reason for hiding this comment

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

I think keeping 46 through 50, but discarding 43 through 45 is the right approach here.

Copy link
Author

Choose a reason for hiding this comment

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

I'm thinking we are talking a little bit past each other here.

You appear focused on the small number of files that do require approval by default while I am focused on the many more files that do not.

In my workflows, agent's habit of making unrequested edits in response to questions and having them autoaccepted after a timeout if I don't notice that it did so is extremely frustrating and actively breaks code.

The existing language is highly ambiguous about what files are and are not protected by default.

That agent does not use autoapproval for a small number of 'sensitive' files is not the point I wish to emphasize in the docs. While useful that some files are protected by default, the lack of default protection for most files has far more impact on my workflows.

The point that is specifically being addressed by my proposed edit is to make it very clear that most files are not protected from autoapproval by default and that if that is an issue for you, this is how you change it.

Does this make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

The default behavior of chat is to apply edits immediately and then ask to approve/reject. That how it's currently designed to work and meets the most common user scenarios.

The point of this section is to describe how to prevent edits to a very specific set of sensitive files. My edits describe both the default scenario, and explain how you can configure a setting to add more files.

If we want to describe in more detail what the default behavior is, another section ("Pending changes") would be more appropriate imo.


The following example configuration automatically allows edits to all files except for JSON files in the `.vscode` folder and files named `.env`, which you are prompted to approve:

Expand Down