Hacker News new | ask | show | jobs
by inanutshellus 2494 days ago
tabs don't work when you visually align code. e.g.

  some.method(param,
              param2,
              param3)
The above doesn't work if the creator of the code uses a different tab width than I do. If you want it to, you need to use an IDE that automatically recognizes the difference between indentation and alignment... which is frankly too much trust in others if you care about it.

If a default install of an IDE (including vIM) will screw up your code.... you might consider rethinking your strategy. :-)

4 comments

That code would be misaligned anyway when someone changes the name of `some` or `method`.

You should format it like this (regardless of whether you use tabs or spaces):

  some.method(
    param,
    param2,
    param3
  )
That would be how I would do it, because generally the coding I do is simple enough that I can trust Visual Studio Code to "Beautify" my finished work and insert all the tabs it needs to align things.
> The above doesn't work if the creator of the code uses a different tab width than I do.

Tab proponents suggest alignment to be done with spaces, and indentation to be done with tabs.

Honestly the I've lost my appreciation for alignment. I've been writing it like this for a while now:

    some.method(
        param, param2, param3)
And it's no more or less easy to read.

    some.method(param,
        param2, param3)