TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Elastic tabstops – a better way to indent and align code

27 点作者 usrme将近 3 年前

3 条评论

kevincox将近 3 年前
While this would be nice, I find that the value it adds is very low. I&#x27;ve settled on tabs for indent and spaces for alignment. And over the years I&#x27;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&#x27;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).<p>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.
Night_Thastus将近 3 年前
What if you want to align things which are not grouped together in consecutive lines?<p>IE:<p><pre><code> doSomething() &#x2F;&#x2F; This is a comment ...random other things here... doSomething2() &#x2F;&#x2F; This is another comment, I want aligned with the first </code></pre> That can be done with tabs&#x2F;tabs replaced with spaces. I just need to hit tab until it aligns with the same tab boundry. But can elastic tabstops do that?
webmaven将近 3 年前
See also: Intelligent Indentation, Seriously — <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31478308" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31478308</a>
评论 #31481586 未加载
评论 #31480526 未加载