xunit/xunit#3336: Fix xUnit2023 fixer trivia and indentation#212
Open
LindqvistMartin wants to merge 1 commit into
Open
xunit/xunit#3336: Fix xUnit2023 fixer trivia and indentation#212LindqvistMartin wants to merge 1 commit into
LindqvistMartin wants to merge 1 commit into
Conversation
The fixer reused the original invocation and lambda nodes without clearing their trivia, so a leading comment on the Assert.Collection statement was copied onto the generated var declaration (and its indentation reset), and a multi-line inspector body kept its original indentation instead of re-indenting under the new statement. Strip the trivia from the reused invocation and normalize the inspector body before reinserting them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes xunit/xunit#3336.
The fixer reused the original invocation and lambda nodes without clearing their trivia, so a
// commenton theAssert.Collectiongot copied onto the generatedvarline (with its indentation reset to column zero), and a multi-line inspector body kept its old indentation instead of lining up under the new statement.Stripping the trivia off the reused invocation fixes the comment; normalizing the inspector body fixes the indentation. Added a regression test for a leading comment, a multi-line collection, and a multi-line inspector.