5 ms·
You can set tab display width for whatever width you prefer, you cannot do the same for space. From accessibility point of view, tabs are more usable for people
by vitro 4y ago
You can set tab display width for whatever width you prefer, you cannot do the same for space.
From accessibility point of view, tabs are more usable for people with sight problems.
- zokier 4y agoIf you have standardized indentation width, then the only difference is how the indentation is stored in the file. You can present either option in arbitrary way to the user. Doing n spaces to m character cells is as simple transformation as 1 tab to m character cells.
- mananaysiempre 4y agoNo, it isn’t[1], not in most formatting styles, if we’re speaking about the usage where the user can adjust the tab width and have the formatting not fall apart. (Note this excludes e.g. Vim or Visual Studioconfigured to use tabs, so that may be a part of the confusion.) The reason is that alignment still needs to be done with spaces: TAB if (foo) { TAB TAB bar(spam, TAB TAB ....eggs); TAB } [1] https://www.emacswiki.org/emacs/SmartTabs https://www.emacswiki.org/emacs/SmartTabs
- jeltz 4y agoNone of what you wrote contradicts the comment you replied to.
- mananaysiempre 4y agoAh whoops, now I’m not sure. Either that comment was saying that with a standardized indentation width, having an option to adjust the indentation width does not matter, which is trivially true and not contradicted by mine but strange to say as a reply to a comment pointing out that option; or it was (implicitly?) saying that with a standardized indentation width in the storage format, you could recover the tabs from the spaces and adjust the result, which is contradicted by my comment: you can’t automatically distinguish indentation spaces and alignment spaces without at least language-syntax smarts, and while the former should be adjusted the latter mustn’t be.
- still_grokking 4y agoNever heard of such feature. Could you tell how to set this up in say VSCode or IntelliJ? AFAIK it works only one way: You can format tabs with an arbitrary number of spaces. But you can't render spaces with anything else than spaces. How should this even work? You would need semantic code analysis to make it happen…
- pharmakom 4y agoThis is an important concern. However, an IDE that understands the source code will be able to render the indentations in a customizable way.
- bb88 4y agoI feel like we're reliving the episode from Silicon Valley where Richard Hendricks broke up with his GF over tabs vs. spaces. In 2023, it is technologically possible for the IDE repo to use tab characters and the git repo to use spaces, or vice versa. Also, in 2023, I don't care anymore.
- pharmakom 4y agoIndeed. Source code is just a human readable storage format. The editor can render whatever is best for readability.
- Octoth0rpe 4y agoI'm not sure I'd be comfortable with an IDE that chooses to render 4 spaces as 2 spaces, etc.
- pharmakom 4y agoSo dont configure it that way? Invisible character display also helps
- still_grokking 4y agoAnyway, until someone links some definitive source that this is indeed implemented I assume that the claim is made up. You would need semantic code analysis just to render whitespace. That's nuts.
- dropofwill 4y agoI've used vim's conceal feature to do something like this before to read some ridiculous code that had 16 space indentations. You can use this for all sorts of fun things like making lambda: render as λ. That doesn't use any code analysis, it's just dumb rendering, not sure why you would need anything else?
- peoplefromibiza 4y agos/^spaces|^tabs/whatever_width_you_want/g that's what every editor does when you set indentation width to N spaces or TAB width to X