Skip to content

Instantly share code, notes, and snippets.

@JackieKu
Created April 19, 2010 16:02
Show Gist options
  • Save JackieKu/371209 to your computer and use it in GitHub Desktop.
Save JackieKu/371209 to your computer and use it in GitHub Desktop.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module IndentStyle
Public Sub Space2()
SetTabAndIndentation(False, 2)
End Sub
Public Sub Space3()
SetTabAndIndentation(False, 3)
End Sub
Public Sub Space4()
SetTabAndIndentation(False, 4)
End Sub
Public Sub Tab4()
SetTabAndIndentation(True, 4)
End Sub
Public Sub Space2Tab8()
SetTabAndIndentation(False, 8, 2)
End Sub
Public Sub Space4Tab8()
SetTabAndIndentation(False, 8, 4)
End Sub
Public Sub Tab8Space2()
SetTabAndIndentation(True, 8, 2)
End Sub
Public Sub Tab8Space4()
SetTabAndIndentation(True, 8, 4)
End Sub
Private Function SetTabAndIndentation(ByVal useTab As Boolean, ByVal tabSize As Integer, Optional ByVal indentSize As Integer = -1)
DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value = useTab
DTE.Properties("TextEditor", "AllLanguages").Item("TabSize").Value = tabSize
If indentSize < 0 Then
DTE.Properties("TextEditor", "AllLanguages").Item("IndentSize").Value = tabSize
Else
DTE.Properties("TextEditor", "AllLanguages").Item("IndentSize").Value = indentSize
End If
End Function
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment