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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: I can't read code indented with 2 spaces: do I need glasses?

3 点作者 danielstudds大约 12 年前
I'm doing a lot of work in Javascript at the moment, and it seems like most of the world indents using only 2 spaces - which I find really hard to read, particularly (say) long grunt config files, where indentation makes a big difference to meaning. Do I just have much worse eyesight than your average coder, am I using the wrong toolset, or do other people have this problem?

7 条评论

ElongatedTowel大约 12 年前
Just an idea I haven't seen implemented yet:<p>Tabs have the advantage of beeing of variable width while spaces don't. But two or more consecutive spaces are rarely used for more than just aligning code. In theory the editor could render double the spaces (or rather a space with twice the width) for every amount of spaces higher than one, effectively doubling the indent.<p>No conversion (retabbing) would have to take place and therefore no hardcoding the value, which often breaks languages which don't like mixed tabs and spaces as the retabber might encounter three consecutive spaces and only convert two of them to a tab if told to do so.
jyu大约 12 年前
Can't you adjust your given IDE / text editor to accomodate? Look for hints in whitespace sensitive languages like python or coffeescript. For instance, you could use retab in vim.<p><a href="http://stackoverflow.com/questions/9104706/how-can-i-convert-spaces-to-tabs-in-vim-or-linux" rel="nofollow">http://stackoverflow.com/questions/9104706/how-can-i-convert...</a>
ratboy666大约 12 年前
True geeks should use their own editor. When I ran across 2 space indentation, I also couldn't keep track. So, I implemented a vertical marking bar in the editor, that I could use to "comb" the code. Works beauty, I suspect that implementations of this idea are available for editors like vim as well.
a3n大约 12 年前
Ask your $PROFESSIONAL.
devonbarrett大约 12 年前
Try another color scheme?<p>But see an optician.
stephenr大约 12 年前
Further proof tabs make more sense.
johnbm大约 12 年前
Try changing your font, line/letter spacing, or turning on indentation guidelines. This is mine: <a href="http://imgur.com/0BSq6lE" rel="nofollow">http://imgur.com/0BSq6lE</a>