Skip to content

Conversation

davidwengier
Copy link
Member

@davidwengier davidwengier commented Jan 24, 2025

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

First commit fixes the bug in the new formatting engine where we sometimes create overlapping edits, and instead now we drop those edits on the floor, so at least most of the file will format correctly.
Second commit then fixes the actual formatting issue with the code in hand, which means we no longer have overlapping edits in the first place.

@davidwengier davidwengier requested a review from a team as a code owner January 24, 2025 00:52
}

if (closeBraceNode.TryGetLinePositionSpanWithoutWhitespace(source, out var closeBraceRange) &&
if (closeBraceNode.Span.Length > 0 &&
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this line, the test on the syntactically invalid document failed, because the compiler apparently adds an empty node at position 0 for the close brace on an invalid document.

@davidwengier davidwengier merged commit aaaf768 into dotnet:main Jan 24, 2025
12 checks passed
@davidwengier davidwengier deleted the StopOverlappingRangesInFormatting branch January 24, 2025 03:36
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 24, 2025
@jjonescz jjonescz modified the milestones: Next, 17.14 P2 Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants