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

fixing issue when formatting with tabs that would convert tabs in com… #1344

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

belav
Copy link
Owner

@belav belav commented Sep 8, 2024

…ments into spaces.

closes #1343

@belav
Copy link
Owner Author

belav commented Sep 8, 2024

This was a pretty quick fix, but leads to a question of what to do when the line in the comments is tabs followed by spaces. This is what I ended up doing. All the leading whitespace in here is tabs unless otherwise indicated by the comments. I think the altenative would be to turn anything less than a full tab into 1 tab, unless it matches the pattern of that first comment.

Or another alternative would be to try to leave alone any whitespace that is "part of the block". Meaning the 3 comments below all start with 2 indents that are tabs, and any whitespace after that is left alone because it is in the block of the multiline comment.

public class Foo
{
	/**
	 * comment - existing behavior, keeps the single space to align the *
	 */
	public class Bar { }

	public void SomeFunction()
	{
		/*
		The following line is an example with an indent:
			This line is indented by one tab.
		*/
		/*
		The following line is an example with an indent:
			This line is indented by 4 spaces but will be converted to 1 tab
		*/
		/*
		The following line is an example with an indent:
		   This line is indented by 3 spaces but will be left as 3 spaces
		*/
	}
}

@belav belav merged commit e90022e into main Sep 15, 2024
3 checks passed
@belav belav deleted the tabs-issue branch September 15, 2024 17:31
pisolofin pushed a commit to pisolofin/csharpier-editorconfig that referenced this pull request 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 this pull request may close these issues.

Comments don't follow tabs indent style
1 participant