4 ms·
Some people indent in a way that breaks with tabs. Like: object1.field1 = value1; longObject2.field3 = value2; longObject23.longField
by ajuc 3y ago
Some people indent in a way that breaks with tabs. Like:
object1.field1 = value1;
longObject2.field3 = value2;
longObject23.longField1 = value3;
or
if ((firstArg == 1 && x == 3)
|| (firstArg == sthElse && x == 4)
|| (thirdArg == 3 && fourthArg == 2)
) { ... }
- cyclotron3k 3y agoYou do the indenting with tabs and the layout with spaces. Then it doesn't break
- lttlrck 3y agoYes that works. Until a variable name changes which could cause the alignment to cross a tab boundary so then instead of just fixing the alignment with spaces you have to convert existing spaces to tabs and realign. It's just more work and to do it reliably requires making tabs visible in the editor though, which is another mark against tabs for many, I'd imagine. I suppose there may be Vim/Emacs realignment macros that take care of it but then we're heading toward the other classic argument.
- cyclotron3k 3y agoI think we're talking about different things. The rule is: nothing should appear to the left of your tabs - use spaces everywhere else. Here's what it should look like (if you really want to go full-alignment): class Demo { \tfunction thing() { \t\tlet height = 123; \t\tlet width = 456; \t\tlet title = "Foo"; \t\tlet description = "Foo bar baz"; \t} }
- deafpolygon 3y agoI just don't indent code like that, but I understand now that others might - and in that case, tab alignment isn't always desirable.
- redhale 3y agoI was reading in an app (Materialistic) and none of that spacing rendered so I was confused. But I see it on the web. Personally, I really hate code formatted like this. I don't really think it's any easier to read, and I find it obnoxious to write/maintain unless the editor does it for you. Just my opinion.