I'm member of several different teams and (of course ;) some teams prefers tabs over spaces and vice versa.
Is there any more user friendly solution then loading user profile via menu->Tools... which is 10 clicks long?
I looked at devenv.exe command line parameters if there is any for loading particular user profile to have two separate *.lnk launchers of Visual Studio, but there isn't such parameter.
Then I tried to record macro, but VS is able to record only the Tools.ImportandExportSettings command and cannot record all the steps of the following wizard.
Thx for suggestions, Petr
Go to File ➤ Preferences ➤ Settings or just press Ctrl + , In the Search settings bar on top insert editor. insertSpaces. You will see something like this: Editor: Insert Spaces and it will be probably checked.
There is a macro in this blog entry by James Alexander to quickly toggle between tabs and spaces within Visual Studio. Then just add a toolbar command that maps to the macro and you have your one click solution.
Public Sub ToggleTabs()
If DTE.ActiveDocument.Language = "CSharp" Then
Dim currentSetting As Boolean = DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value
DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value = Not currentSetting
End If
If DTE.ActiveDocument.Language = "SQL" Then
Dim currentSQLSetting As Boolean = DTE.Properties("TextEditor", "SQL").Item("InsertTabs").Value
DTE.Properties("TextEditor", "SQL").Item("InsertTabs").Value = Not currentSQLSetting
End If
If DTE.ActiveDocument.Language = "HTML" Then
Dim currentHTMLSetting As Boolean = DTE.Properties("TextEditor", "HTML").Item("InsertTabs").Value
DTE.Properties("TextEditor", "HTML").Item("InsertTabs").Value = Not currentHTMLSetting
End If
If DTE.ActiveDocument.Language = "JScript" Then
Dim currentJScriptSetting As Boolean = DTE.Properties("TextEditor", "JScript").Item("InsertTabs").Value
DTE.Properties("TextEditor", "JScript").Item("InsertTabs").Value = Not currentJScriptSetting
End If
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With