-
Notifications
You must be signed in to change notification settings - Fork 259
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to hard tabs for indentation #31
Comments
Helpful for those who are sight-impaired & have atypical font & indentation sizes. |
Hi @Cherry, I appreciate your detailed discussion, and you make some good points. Ultimately, though, just as technology has overcome the problems that tabs had in the past (when too many editors treated them as always 8-space), technology can also overcome the problems with spaces (most editors are able to deduce the indentation stops and treat spaces the same as they would tabs). At the end of the day, these are simply two different encodings of the same semantic information, and if they behave any differently in editors at all, that is a problem to fix in the editor. There is no reason an editor cannot adjust indentation widths when the indentation happens to be encoded with spaces. Meanwhile:
So, it doesn't make sense to us to make any changes at this time. Eventually, we would like to adopt auto-formatting, although our experiments with ClangFormat so far have not produced acceptable output. Assuming we can fix the issues, then an auto-formatted codebase would make it even easier for everyone to use whatever they personally prefer -- you can always auto-format files to your preferred format, make your changes, and auto-format back before committing. (Hopefully, editors can do this automatically.) |
While this is disappointing, and I wish I shared your optimism here, I understand. Thank you for the response. I'll pin this for revisit again in the future. |
First of all, so excited for this release! I'm barely 1/10th done reading through the source 馃憖
Prior precedent:
Everyone has their own opinions about how much visual indentation they want in their code. Some prefer 2 spaces, some prefer 4, and then some users may be visually impaired and need higher font sizes with smaller tab widths, etc.
There's been a tonne of debate over the years about which is better, and it's always come to down to arguments that are opinion based, but the one major and consequential difference between the two is this:
Tabs allow individuals in the same codebase to select their indentation widths across every tool.
To affirm the accessibility issue, I'd recommend reading through https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/:
Other references:
In the JavaScript ecosystem, Prettier is likely to switch to
useTabs
by default with the next major version too, for this exact reason: prettier/prettier#7475Other than the obvious code change differences, shipping an
.editorconfig
in this repo for some sensible defaults would probably be a good idea too, to combat one of the most common counters to this, which is how some tools render tabs by default. This way, tools like GitHub can render tabs with a 4 character width by default instead of the usual 8, but folks can still customise this themselves if they so choose. Something like this:I'd like to avoid any debate around personal preference here and focus on the accessibility issue of continuing to indent code with spaces.
The text was updated successfully, but these errors were encountered: