locked
Indent Style RRS feed

  • Question

  • How do I temporarily change the active document's indent style within a macro?
    Saturday, April 15, 2006 1:02 AM

Answers

  • Here is one way to do this.  Change "CSharp" to the language you want.  You can find what the language name should be by looking under the registry key HKLM\Software\Microsoft\VisualStudio\%VerNum%\AutomationProperties\TextEditor.  This code sets the indent style to None.  Using 1 would set it to Block and 2 would set it to Smart (if it is available).

    For Each prop As EnvDTE.Property In DTE.Properties("TextEditor", "CSharp")

    If prop.Name = "IndentStyle" Then

    prop.Value = 0 ' Change to the value you want.

    End If

    Next

    Thanks,

    Dylan

    Monday, April 17, 2006 8:14 PM

All replies

  • Is this even possible?
    Monday, April 17, 2006 5:30 PM
  • Here is one way to do this.  Change "CSharp" to the language you want.  You can find what the language name should be by looking under the registry key HKLM\Software\Microsoft\VisualStudio\%VerNum%\AutomationProperties\TextEditor.  This code sets the indent style to None.  Using 1 would set it to Block and 2 would set it to Smart (if it is available).

    For Each prop As EnvDTE.Property In DTE.Properties("TextEditor", "CSharp")

    If prop.Name = "IndentStyle" Then

    prop.Value = 0 ' Change to the value you want.

    End If

    Next

    Thanks,

    Dylan

    Monday, April 17, 2006 8:14 PM