this post was submitted on 17 Jun 2023
52 points (100.0% liked)

Programmer Humor

32061 readers
967 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] edward@lemmy.ml 2 points 1 year ago* (last edited 1 year ago) (1 children)

if you change tab with then your space alignment breaks

No, it doesn't? Here's the exact same text content with different tab widths:

The tabs are smaller but the spaces are the same, so the alignment remains.

[–] Vlyn@lemmy.ml 2 points 1 year ago (1 children)

Ah, I see what you mean, out of instinct I'd have put one more tab on the "whatever" line, which would break the concept. But if you manually do both the indent + alignment in spaces then it works.

Besides your IDE of choice screaming at you that you are mixing tabs and spaces that is :)

It still feels like a hack though, simply going with spaces is more uniform and works everywhere. Especially as a lot of code is viewed in browsers nowadays (GitHub, GitLab, ..) and tabs are often a mess in those environments.

[–] edward@lemmy.ml 1 points 1 year ago

Besides your IDE of choice screaming at you that you are mixing tabs and spaces that is

JetBrains IDEs actually have it built in, it's called "smart tabs".