41 ms·
If 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 wa
by zokier 4y ago
If 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…