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…
TAB if (foo) {
TAB TAB bar(spam,
TAB TAB ....eggs);
TAB }
[1] https://www.emacswiki.org/emacs/SmartTabsYou would need semantic code analysis just to render whitespace. That's nuts.
Because this would not work in the general case. Without code analysis you can't know which spaces are indentation and which aren't. Spaces are everywhere in code…
You could have some heuristic like "new-line followed by x spaces" but this wouldn't work correctly in all cases.
Thanks for the pointer to vim's conceal feature, btw! I'm looking for something like that, but I'm not using vi(m) (I'm too lazy to learn it, even after 20 years of desktop Linux). Now I know what VSCode extension to look for. Does something like that exist that works on the AST level? (May be even some external filter-like tool).
Invisible character display also helps
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.
s/^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