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

Comments don't follow tabs indent style #1343

Closed
J05HM0N5TER opened this issue Sep 8, 2024 · 2 comments · Fixed by #1344
Closed

Comments don't follow tabs indent style #1343

J05HM0N5TER opened this issue Sep 8, 2024 · 2 comments · Fixed by #1344
Milestone

Comments

@J05HM0N5TER
Copy link

When formatting the document, any comments which have indenting, get updated to use space indenting, even when indent style is set to tabs. The indenting provided by the function is kept, but the extra indenting from the comment is spaces. This makes the indenting in this example [tab][tab][space][space][space][space] instead of [tab][tab][tab].

I found out this problem because VS Code highlights lines with inconsistent indenting, and I was writing pseudocode in a comment block. I apologise for the awful looking formatting, but it is the best way I could find to demonstrate the problem.

Input:

	public void ExampleFunction()
	{
		/*
		The following line is an example with an indent:
			This line is indented by one tab.
		*/
	}

Output:

	public void ExampleFunction()
	{
		/*
		The following line is an example with an indent:
		    This line is indented by one tab.
		*/
	}

Expected behavior:

	public void ExampleFunction()
	{
		/*
		The following line is an example with an indent:
			This line is indented by one tab.
		*/
	}
@belav
Copy link
Owner

belav commented Sep 8, 2024

@J05HM0N5TER feel free to weigh in on the comment I left in #1344. Not sure if either of the two alternatives would be better than the fix I implemented.

@belav belav added this to the 0.29.2 milestone Sep 8, 2024
@J05HM0N5TER
Copy link
Author

@J05HM0N5TER feel free to weigh in on the comment I left in #1344. Not sure if either of the two alternatives would be better than the fix I implemented.

I think that looks like a great way to resolve it. I think if the user puts 4 spaces with indenting it will format the same as a tab anyway, and it will keep the indenting more consistent. This also means that if the user wants to have 1–3 spaces of indenting, like if they have something that they intend to line up with something on another line, then they can do that.

Thank you for creating a fix for this so quickly.

belav added a commit that referenced this issue Sep 15, 2024
pisolofin pushed a commit to pisolofin/csharpier-editorconfig that referenced this issue Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants