3 ms·
No IDE I know of can reliably convert spaces to tabs in a display mode only (= without actually causing code changes).
by scrollaway 7y ago
No IDE I know of can reliably convert spaces to tabs in a display mode only (= without actually causing code changes).
- dkersten 7y agoAlso, not every space necessarily should be converted to tabs, especially if you follow the “tabs for indentation, spaces for alignment” mentality: you will want everything up to the indentation level converted but not everything after. I’m sure some editors can do this, but many also definitely can’t. Tabs just work, everywhere.
- organsnyder 7y agoThis seems like something that could be resolved with a couple of git hooks: post-merge: Reformat code based on local developer preference. pre-commit: (1) Reformat code back to repository standard. (2) Revert changes that are solely whitespace-related. I'm not aware of a tool that would do the last step automatically, but it doesn't seem like it would be too hard to implement. And perhaps (I haven't checked) git has a built-in config option to alter how it behaves for whitespace-only changes?
- colordrops 7y agoThere is no need to convert though. Vim for instance can work with spaces as if they were tabs.
- prepend 7y agoI’ve had success with vscode converting spaces to tabs and vice versa between open and save. Knock on wood, I haven’t had it bungle any code. I do this because some projects like tabs, some like 2 spaces, some like 4 spaces and I like coding in a particular way that’s independent of the particular projects.