Reputation: 93
Before someone tries to mark this as a duplicate, DON'T. Please read the question very carefully. I've seen similar questions asked (and answered incorrectly).
I am using Visual Studio Code. I have code that has used tabs WITHIN A LINE, not just at the beginning, to format columns. I am trying, unsuccessfully, to convert those tabs to the appropriate number of spaces to maintain the columns.
Before you suggest ctrl-shift-I, that only works on LEADING tabs, not those within the line. Also, don't suggest the "Untabify" or similar extensions. Those only convert every tab to 4 (or however many) spaces without determining how many spaces would be appropriate to maintain the tab stops.
Visual Studio 2008 had an "untabify" function that would do exactly what I am looking for. It doesn't seem to have been carried over to VSCode.
Thanks, Greg Thanks.
Upvotes: 9
Views: 8271
Reputation: 91
Another solution which does not involve an extension:
Upvotes: 9
Reputation: 54
None of "untabify" extension do not work as I expect. "Edit with Shell Command" extension with "expand" command works.
Upvotes: 2
Reputation: 175
in the meantime, someone created the extension which solves your problem:
https://github.com/dmfabritius/untabify
Upvotes: 3
Reputation:
Do a search for Regex's \t
and replace with your wanted number of spaces?
Upvotes: -2