3 ms·
While that may be true, "spaces for alignment" is nigh unsupported by all editors I've seen. They insist on replacing 8 (or N) spaces with tab even if in an ali
by mathstuf 4y ago
While that may be true, "spaces for alignment" is nigh unsupported by all editors I've seen. They insist on replacing 8 (or N) spaces with tab even if in an alignment region.
int foobar(int a,
___________int b) // should only ever have spaces (using _ here because HTML)
But good luck finding an editor that won't insert a tab when you use the tab key here (willing to be wrong).
The other issue I have is that diffs break alignment between undented code and anything with tabs because the tabs "eat" the leading space, but unindented lines are offset by one.
- CoastalCoder 4y agoI'm curious what editors you've experienced that with. I've had some editors that made tab-space conversion an option, but it was never mandatory.
- mathstuf 4y agoWhen I'm working in Git, Go, or Linux code, Vim (and NeoVim) uses `expandtab` in conjunction with `softtabstop` and converts any `tabstop` spaces into a tab (with `noexpandtab`) regardless of whether or not it is "alignment". I've not done lots of development with other editors, but Kate didn't do it and the few times I used Visual Studio, it also had similar behaviors (I'm assuming VSCode inherited that stuff).
- charsi 4y agoWith a .editorconfig[1] file with the correct configs you can get most code editors to insert spaces instead of tabs. [1] https://editorconfig.org/ https://editorconfig.org/
- mathstuf 4y agoWhat configuration is necessary for editors to insert spaces in code like this: https://lore.kernel.org/keyrings/20221109025019.1855-2-linux@weissschuh.net/T/#Z2e.:..:20221109025019.1855-3-linux::40weissschuh.net:1include:linux:key.h https://lore.kernel.org/keyrings/20221109025019.1855-2-linux... If HN mangles the link, it is the addition of the `key_create` function in this thread: https://lore.kernel.org/keyrings/20221109025019.1855-2-linux@weissschuh.net/T/#u https://lore.kernel.org/keyrings/20221109025019.1855-2-linux...
- bobbylarrybobby 4y agoRustfmt, for one, understands how to mix tabs and spaces on the same line. I think the complication is overstated.
- philliphaydon 4y agoAll JetBrains editors will put spaces.