Elastic tabstops – a better way to indent and align code

  • While this would be nice, I find that the value it adds is very low. I've settled on tabs for indent and spaces for alignment. And over the years I've found that I do less and less alignment and that is is rarely benificial. The biggest problem is that it creates noisy diffs when you add or remove the longest element in a group, and that would be resolved by elastic tabstops. But I also don't see much value in separating the comment from the code by a sea of whitespace. If I have a comment talking about multiple lines of code I just put it in front. If I have a long comment about one line I just let it soft-wrap (or put it in front and use paragraphs).

    So yes, these would be nice and would improve my coding experience. But the improvement would be tiny compared to the fight of trying to get everyone to use them.

  • What if you want to align things which are not grouped together in consecutive lines?

    IE:

      doSomething()         // This is a comment
      ...random other things here...
      doSomething2()        // This is another comment, I want aligned with the first
    
    
    That can be done with tabs/tabs replaced with spaces. I just need to hit tab until it aligns with the same tab boundry. But can elastic tabstops do that?

  • See also: Intelligent Indentation, Seriously — https://news.ycombinator.com/item?id=31478308