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

Indent c style multiline comments correctly when they switch indentation. #606

Closed
belav opened this issue Feb 9, 2022 · 0 comments · Fixed by #626
Closed

Indent c style multiline comments correctly when they switch indentation. #606

belav opened this issue Feb 9, 2022 · 0 comments · Fixed by #626
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@belav
Copy link
Owner

belav commented Feb 9, 2022

When a file is using the /* style comment and starts with tabs or 2 spaces for indentation, then the comments do not get indented correctly.

See https://github.com/belav/csharpier/releases/tag/comments for some possible code.

  public void Method()
  {
    /*  multiline 
     *  multiline
     */
    var variable = true;
  }

// should be

    public void Method()
    {
        /*  multiline 
         *  multiline
         */
        var variable = true;
    }

Commented out code should retain its formatting.

/*
public class CommentedCodeShouldKeepFormatting
{
    void MethodName() { }
}
*/
@belav belav changed the title Figure out better solution to comments that need to move Indent c style multiline comments correctly when they switch indentation. Feb 9, 2022
@belav belav added area:formatting type:bug Something isn't working labels Feb 9, 2022
@belav belav added this to the 0.16.0 milestone Feb 9, 2022
belav added a commit that referenced this issue Feb 28, 2022
shocklateboy92 added a commit that referenced this issue Mar 9, 2022
* Better handling of multi-line comments

closes #606

* Code review changes

* Fixing test

* Update test case to explain my point

* Fixing edge case with moving comments left

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
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant