fix: preserve blank lines before csharpier-ignore comments#1868
Merged
belav merged 4 commits intoJun 5, 2026
Conversation
Fixes belav#1867 Preserve leading blank-line trivia for ignored statement nodes and add regression coverage for csharpier-ignore formatting edge cases.
nkgotcode
force-pushed
the
fix/oss-784-csharpier-ignore-blank-lines
branch
from
June 4, 2026 22:57
7912fdc to
d21f902
Compare
belav
requested changes
Jun 5, 2026
| return statements; | ||
| } | ||
|
|
||
| public static Doc PrintNodeWithoutFormatting(SyntaxNode syntaxNode, PrintingContext context) |
Owner
There was a problem hiding this comment.
These three methods have almost the same name and I have no idea what the difference between them is and when to call which method.
| } | ||
|
|
||
| [Test] | ||
| public async Task CSharpier_Ignore_Preserves_Preceding_Blank_Line() |
Owner
There was a problem hiding this comment.
These tests have no reason to be in this class if all they are doing is ensuring that a blank line is not removed. That is what the csharpierignore.test file is for.
Contributor
Author
|
Pushed e177a63: renamed the unformatted-print helpers to distinguish Doc wrapping from raw code normalization, and moved the blank-line regression cases into |
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.
Summary
Fixes #1867
Preserves leading blank-line trivia for ignored statement nodes when formatting files that use
// csharpier-ignorecomments, and adds regression tests.Test plan
CSharpierIgnoreexpected snapshotsLineEndingEdgeCasecoveragedotnet testonCSharpier.TestsCloses #1867
Made with Cursor