Converting tabs in leading whitespaces to double spaces in Visual Studio macro
I'm trying to modify a VS macro I found on this site; the macro performs a transformation to a document when it is saved. I need the macro to transform the leading whitespaces such that each tab characters are replaced with two spaces but leave all the existing spaces intact. I tried the code below but it is not working the way I would like it to. May I get some help with it?
If vsFindResult.vsFindResultReplaced = _
DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _
"^{ }*\t", _
vsFindOptions.vsFindOptionsRegularExpression, _
开发者_运维问答 "\1 ", _
vsFindTarget.vsFindTargetCurrentDocument, , , _
vsFindResultsLocation.vsFindResultsNone) Then
document.Save()
End If
Try the "Productivity Power Tools" from Microsoft. Between many other tools there is a tool called "Fix Mixed Tabs" which is doing exactly what you're searching for.
Link to description and download Productivity Power Tools in Visual Studio Gallery
精彩评论