-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Have copilot handle formatting better #51114
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
base: main
Are you sure you want to change the base?
Conversation
Updated guidelines for committing changes and testing. dotnet format doesn't allow for formatting a single file. If copilot tries to format, it'll try the file, then the solution, and then the project resulting in lots of formatting. This will enable us to fix formatting but not mess up the diffs.
This PR is targeting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the GitHub Copilot instructions to improve the code formatting workflow. The change addresses an issue where dotnet format
can cause excessive formatting changes across multiple files when trying to format a single file.
- Added guidance to commit changes before formatting to separate logical changes from formatting changes
- Added instruction to update
.git-blame-ignore-revs
file to prevent formatting commits from affecting git blame history
- When generating code, run `dotnet format` to ensure uniform formatting. | ||
- Prefer using file-based namespaces for new code. | ||
- Do not allow unused `using` directives to be committed. | ||
- commit your changes, and then format them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalized the first word of the sentence for consistency with other guidelines.
- commit your changes, and then format them. | |
- Commit your changes, and then format them. |
Copilot uses AI. Check for mistakes.
- Prefer using file-based namespaces for new code. | ||
- Do not allow unused `using` directives to be committed. | ||
- commit your changes, and then format them. | ||
- add the format commit SHA to the .git-blame-ignore-revs file so that the commit doesn't dirty git blame in the future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalized the first word of the sentence for consistency with other guidelines.
- add the format commit SHA to the .git-blame-ignore-revs file so that the commit doesn't dirty git blame in the future | |
- Add the format commit SHA to the .git-blame-ignore-revs file so that the commit doesn't dirty git blame in the future |
Copilot uses AI. Check for mistakes.
It'll be interesting to see if it will create the git-blame-ignore-refs file in the first place! |
Updated guidelines for committing changes and testing. dotnet format doesn't allow for formatting a single file. If copilot tries to format, it'll try the file, then the solution, and then the project resulting in lots of formatting. This will enable us to fix formatting but not mess up the diffs.