This is an absolutely necessary plugin for code pedants like myself who keep Show Whitespace on at all times and cringe whenever we see source code with tabs mixed with spaces. Thanks for updating it for VS 2013, Noah!
Exactly what I was looking for! I'm currently using WinJS for a Windows Store App in VS 2012 and this works great for the .js, .css, and .html pages that contain mixed whitespace. We use spaces. The online code diffs looks awful when tabs sneak in to the code.
Endless annoying pop-ups and selecting 'Don't show again' doesn't work. I want to keep productivity tools because of the useful solution navigator but I may just have to get rid of it because of this pointless broken tab 'tool'...
You can disable individual extensions inside the productivity power tools. I'm not sure if the version there is up-to-date with this one, as I fixed bugs like the one you mention awhile back. Thanks for your feedback.
I have better things to worry about than whether my whitespace takes up 1 or 4 bytes. I uninstalled the Power Tools extension because it included this thing, and I couldn't turn it off. That is without renaming DLLs, installing separately, and jumping through other hoops.
Sorry! I'm working on it, but I lost my windows VM and so I had to rebuild things (a few days of installing software and updates). I should be all set up to rebuild and then test with vs2013, so I'm hoping to get it done this weekend. -Noah
I believe this extension is still also included with the Pro Power Tools. If you have that installed, then you'll have to disable that version of the extension (Tools->Options->Productivity Power Tools).
Couldn't there be an option in this cool tool to automatically tabify or untabify the page as soon as this app find a mixed tabs file instead of having to click every time on the Tabify button to make it work ? Like a checkbox in Options -> Productivity Power Tools -> Fix Mixed Tabs for example ?
Is it a file on disk, or is it generating the SQL by pulling it out of the database?
In it's current form, the extension requires there to be an on-disk representation of the buffer before it'll do anything, essentially because otherwise saving the result isn't a meaningful operation (as far as the extension logic can tell). I'll take a look at alternatives, but I'm not too hopeful :-/
I found that actually it works, but a strange (designed?) way:
I have an ident size 3 and I'm using keep tabs. If the file not contains at least one tab and at least three space the tabify never kicks in. Also if the leading tabs ends with spaces the spaces won't remove.
Example (the same for any file not only for sql scripts):
Tabify won't remove the space between the select and the last tab.
I think when I choose "tabify" the leading spaces should be divide by 3 then replaced with tabs and finally the remaining spaces should be removed.
In summary "tabify" should never leave any single leading space in the document.
Ah, I see.
The extension uses the definition of Tabify that VS uses, which isn't the same as, say, fix formatting. Specifically, it never modifies the amount of indent, just switches each indent-level's worth of spaces into a tab, leaving the existing indent level in place. You should try format document, to see if that works.
As for the last thing you said ("'tabify' should never leave any single leading space in the document"), there are people who actually use settings like tab size = 8 and indent size = 4, so you can get in situations where 3 indent levels is (intentionally) a mix of tabs and spaces. It was actually a point of great contention when we *removed* separate tab/indent sizes in the middle of Dev10 and put them back right at the end :(
Long story short, I'm sorry for the confusion :( If format document (or select all -> format selection) doesn't work for you, send me an email (noahric @ ms) and I'll see if I can write you up an extension that does what you ask (removes the extra spaces after the tabs in the indentation).
Unfortunately there is no format document option for sql scripts in vs. For other files types like c# where format document is available the "fixed tabs" extension is not required at all. For that files I use the "format document on save" feature from powercommands.
Most of the files where we have mixed tabs are designer/tool generated files. Some of these files (like a winform designer file) auto-generated and so pointless to fix mixed tabs.
But there are files which generated only once: templated files, imported sql scripts and so on. For these files would be very useful when the extension remove all leading spaces. All of my indenting settings (for any file type) using tabs instead spaces. These settings are 100% ignored by visual studio built in tools (the tools generating files usually with 4 spaces indenting). Would be a nice feature of mixed tabs to fix these files.
Anyway I don't expect from mixed tabs to format a document, I think we only want to fix indenting, nothing more.
Thanks for this great extension :)
I was just working on some unit tests that relied on some strings matching. The Tabify button changed some spaces to tabs and my unit tests broke. Can you fix the tool to ignore verbatim strings that use the C# "@" symbol. Here is an example:
There are 4 spaces to the left of this line that tabify turns into a tab character.
line 3", str1);
(Do you know if this will get synch'ed into the Pro Power Tools, that's how I had installed the tool?)
No promises, but I'll take a look to see how easy it'll be. I have two worries about fixing this, though:
1) It will be slow to use the language service to classify every line in the file to see if any are in strings/when replacing, and even that would rely on the language service classifying the whitespace at the start of the line as a string (I'm not sure if any/all do).
2) I could write a custom parser for it, but it would have to be language specific, and I'd rather not do that.
Still, I'll take a look and see just how bad it is.
Thanks for reporting this!
Hey all, if you've seen issues around performance or the information bar showing up again and again even after clicking Tabify (and then saving again), can you give out version 2.1 or later a try and see if it fixes your issues? Thanks!
Hi, I'm not able to remove this extension from VS 2010. I thought this extension would be pratical, but I have to many files.
I tried to unistall by 2 ways: 1) in VS 2010 - TOOLS - EXTENSION MANAGER or 2) in AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\ I deleted the folder.
For both ways, I restart VS2010 but the message "You have mixed tabs and spaces. Fix this?" is still appearing. Do you have a way to remove this message?
Not in the current version, no :-/ They are planning that for future releases.
You have two options, though:
1) Find the dll for FixMixedTabs (I think it is still called that) in the power tools extension folder and rename it to .dll.DISABLED
2) Install the standalone version again and disable the extension (the power tools version disables itself if the standalone is present, and it doesn't check to see if the standalone is enabled or not. Net effect is both are disabled)