Skip to content
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

Csharpier removes empty lines in ignored blocks of code #742

Closed
MonstraG opened this issue Oct 18, 2022 · 1 comment · Fixed by #746
Closed

Csharpier removes empty lines in ignored blocks of code #742

MonstraG opened this issue Oct 18, 2022 · 1 comment · Fixed by #746
Milestone

Comments

@MonstraG
Copy link

MonstraG commented Oct 18, 2022

Reproduction code:

public class ClassName 
{
    public void LongUglyMethod() 
    { 
    	// csharpier-ignore-start
        LongUglyMethodName(context, magic[1],
            "very-long-string-one",
            "very-long-string-two",
            "very-long-string-three"
        );

        LongUglyMethodName(context, magic[2],
            "very-long-string-one",
            "very-long-string-two",
            "very-long-string-three"
        );
        // csharpier-ignore-end
        
        // csharpier-ignore
        LongUglyMethodName(context, magic[1],
            "very-long-string-one",
            "very-long-string-two",
            "very-long-string-three"
        );

        // csharpier-ignore
        LongUglyMethodName(context, magic[2],
            "very-long-string-one",
            "very-long-string-two",
            "very-long-string-three"
        );
    }
}

Expected:
no changes

Actual:
image

What's funny, is that the only white line that is not covered by ignore IS preserved,

@belav
Copy link
Owner

belav commented Oct 24, 2022

It was even worse in a case like this....

public class KeepLines1
{
    // csharpier-ignore-start
    private string    first;

    private string    second;
    // csharpier-ignore-end
}

// became

public class KeepLines1
{
    // csharpier-ignore-start
    private string    first;private string    second;
    // csharpier-ignore-end
}

It should behave as expected with the next release. Thanks for the report!

shocklateboy92 added a commit that referenced this issue Nov 11, 2022
* Fix so that empty lines inside of ranged ignores are maintained.

closes #742

* Dealing with trailing whitespace + EOL in ranged ignores.

* fixing warning

Co-authored-by: Lasath Fernando <devel@lasath.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants