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

Mutliline comments always indented with spaces #891

Closed
MonstraG opened this issue May 8, 2023 · 9 comments
Closed

Mutliline comments always indented with spaces #891

MonstraG opened this issue May 8, 2023 · 9 comments
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@MonstraG
Copy link

MonstraG commented May 8, 2023

public class Foo
{
	/**
	 * comment
	 */
	public class Bar { }
}

=>

public class Foo
{
 /**
  * comment
  */
	public class Bar { }
}

.csharpierrc.yaml

printWidth: 100
useTabs: true
tabWidth: 4

Btw, there is no way to check this on playground because it's always in spaces mode.

@belav belav added type:bug Something isn't working area:formatting labels May 8, 2023
@belav belav added this to the 0.25.0 milestone May 8, 2023
belav added a commit that referenced this issue May 8, 2023
@belav
Copy link
Owner

belav commented May 8, 2023

I've been meaning to add width + spacing options to the playground for a while now, hopefully I will get to it soon.

Is this bug frustrating enough for you that I should push out a release right away?

@MonstraG
Copy link
Author

MonstraG commented May 8, 2023

Is this bug frustrating enough for you that I should push out a release right away?

Nah, it's not that bad.

@IT-CASADO
Copy link

Is this broken in 0.26?

Currently CSharpier formats my multiline comments always with spaces.

/*
    my editorconfig has TAB configured, but CSharpier is formatting this comment with spaces
*/
public class SomeClass
{
    public Guid Id { get; private init; }
}

@IT-CASADO
Copy link

It seems, that only space "inside" the comments are formatted with spaces. The general intendation is formatted with tabs.

image

@MonstraG
Copy link
Author

MonstraG commented Dec 15, 2023

That seems correct to me, tabs are for indentation, and spaces inside of comments are for alignment:

	/*
	  e.g.: magic?.property
	             ^
	  if this is styled with tabs, `^` would point to different places
	*/
	public static async extern protected whatever function Name()

@belav
Copy link
Owner

belav commented Dec 16, 2023

I don't think I intended for the CSharpier to change tabs within block comments, it may have been a side effect of supporting the first two comments in this test file. I'm inclined to say that CSharpier should work the way the file on the left looks, Replacing the indentation in front of the comment, but leaving anything "within" the comment alone. In this case it replaced the tab that was within a comment with 4 spaces.

image

@belav
Copy link
Owner

belav commented Dec 16, 2023

This is maybe a better example
image

@IT-CASADO
Copy link

I would agree with your given expectation.

@belav
Copy link
Owner

belav commented Dec 16, 2023

I opened #1075 to address it

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

No branches or pull requests

3 participants