32
loading...
This website collects cookies to deliver better user experience
4
rather than the initial value of 8
, but then again, what if the users has somehow set their editor actual tab width to display as 2
spaces? You can see where this is going and it’s not what “tab fans” are talking about, which they claim that tab invented for this purpose. NO, Tabs where not invented for indentation purposes and usage, their main usage was for presenting Tabular data on old screen that have had the capability of displaying mostly 80 X 25 characters, so, in order to align columns, a special character with variable and adaptive width invented:MyFunc
code with tabs and setting CSS property tab-size to 2
, you can imagine what will happen…:4
, and this will be the case for even custom tab size into editors, it will break every alignment; and even for presenting on the web, you may argue that we won’t set the tab-size to 2
, we’ll set it to 4
that we know it will work with our code, but guess what… code sharing platforms like Github don’t directly care about tab widths and these are having tab-size CSS property being the value of each page the code is being displayed, with of course the default initial value of 8
(for dev.to the tab-size
is set to 2
) and our code will look like this:2
, 4
or 8
:.editorconfig
file with indent_style = tab
and indent_size = 4
, but why bother with all of these? To let users display the width they like? Well even though custom tab widths will break alignment, that’s a reason and the only reason in my opinion and the fact is that this will be an issue for both editing code with custom tab widths and sharing code with other people. You can read more about Github and resolving Tab indentation issues here How to change tab size on GitHub?..editorconfig
(which I doubt), but until then, people should use Spaces for indentation and alignment, at least for code/projects they’re going to share in public.