Skip to content

Do not do full cleanup when we are formatting a new document#79508

Merged
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:do-not-do-full-cleanup-during-new-document-formatting
Jul 22, 2025
Merged

Do not do full cleanup when we are formatting a new document#79508
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:do-not-do-full-cleanup-during-new-document-formatting

Conversation

@jasonmalinowski
Copy link
Member

The CodeAction.CleanupDocumentAsync was added in #59091 to ensure the document had elastic trivia formatted before we applied the result to the file. It appears the intent was to do just the trivia formatting, but the CleanupDocumentAsync does a lot of expensive operations around simplification and adding imports, which aren't needed in this case.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1540532

The CodeAction.CleanupDocumentAsync was added in
dotnet#59091 to ensure the document
had elastic trivia formatted before we applied the result to the
file. It appears the intent was to do just the trivia formatting, but
the CleanupDocumentAsync does a lot of expensive operations around
simplification and adding imports, which aren't needed in this case.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1540532
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner July 22, 2025 01:15
@jasonmalinowski jasonmalinowski self-assigned this Jul 22, 2025
@jasonmalinowski jasonmalinowski merged commit c765c39 into dotnet:main Jul 22, 2025
26 checks passed
@jasonmalinowski jasonmalinowski deleted the do-not-do-full-cleanup-during-new-document-formatting branch July 22, 2025 18:30
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 22, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants