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

Option for indentation #645

Closed
jods4 opened this issue Apr 8, 2022 · 3 comments · Fixed by #649
Closed

Option for indentation #645

jods4 opened this issue Apr 8, 2022 · 3 comments · Fixed by #649
Labels
area:documentation Improvements or additions to documentation area:formatting priority:medium type:enhancement New feature or request
Milestone

Comments

@jods4
Copy link

jods4 commented Apr 8, 2022

First, thanks for this project!
I'm a big fan of Prettier and really happy to see a similar formatting tool for C#.

I understand the opiniated Prettier philosophy of keeping options to a strict minimum that is now frozen, but I feel like indent style (tabs vs spaces) and width are amongst the few things that should be configurable.
They are (unreasonably) very polarizing and forcing spaces might hinder adoption of Csharpier.

I'm sure you're aware that Prettier does let you configure them:
https://prettier.io/docs/en/options.html#tab-width
Also observe the default Prettier tab-width is 2, csharpier uses 4.

The best part is that it seems you already have full support for those option, they just need to be exposed?
https://github.com/belav/csharpier/blob/master/Src/CSharpier.Cli/ConfigurationFileOptions.cs#L44-L48

@belav
Copy link
Owner

belav commented Apr 9, 2022

Those options were hidden early on with the thought that maybe everybody had settled on using 4 spaces for indentation. I always assumed that eventually someone was going to request that it gets added so left the code around so it would be easy to re-add the options.

I'll get the options back in for the next release!

@belav belav added area:documentation Improvements or additions to documentation type:enhancement New feature or request area:formatting priority:medium labels Apr 9, 2022
@belav belav added this to the 0.17.0 milestone Apr 9, 2022
@jods4
Copy link
Author

jods4 commented Apr 10, 2022

that maybe everybody had settled on using 4 spaces for indentation

😁 You don't read twitter enough!
Seems this debate is heated as ever, although I don't really get it myself.

Personally I like 2-spaces, prettier style.
I've read that in teams where some devs have vision disabilities, using tabs is really important.

@belav
Copy link
Owner

belav commented Apr 18, 2022

I've read that in teams where some devs have vision disabilities, using tabs is really important.

I read an article that made a really good case for that. Someone worked on a team where they needed both extremes, the tabs being about the size of one space and the size of eight spaces.

It would also mean that people with a preference for two spaces don't have to fight with people that prefer four spaces. My other complaint about tabs was how large github displays them, but I just discovered you can use customize them in your account page or using a query string.

CSharpier followed prettier in using two space aligns in some cases (even when indent is set to 4 spaces or tabs) which would probably cause issues for someone who is using tabs because vision disabilities. I think that is a good argument for #617.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:documentation Improvements or additions to documentation area:formatting priority:medium type:enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants