Share via


EditPoint.Indent Method

Indents the selected lines by the given number of indentation levels.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub Indent ( _
    Point As TextPoint, _
    Count As Integer _
)
void Indent(
    TextPoint Point,
    int Count
)
void Indent(
    [InAttribute] TextPoint^ Point, 
    [InAttribute] int Count
)
abstract Indent : 
        Point:TextPoint * 
        Count:int -> unit 
function Indent(
    Point : TextPoint, 
    Count : int
)

Parameters

  • Point
    Type: EnvDTE.TextPoint
    Optional. A TextPoint object endpoint for indentation. The default is the current line in the buffer, causing the current line in the buffer to be indented.
  • Count
    Type: System.Int32
    Optional. The number of displayed columns to indent the lines. The default value is 1.

Remarks

Indent indents the lines bounded by the edit point and Point, including the lines that contain the endpoints. Each line indents the given number of indentation levels. One indentation level is the number of display columns determined by the global editor's setting. Indent does not perform smart formatting or indent lines based on the context of the code. Smart formatting is auto-formatting of code done by the particular language. You can select smart formatting in each language node of the Options command on the Tools menu.

Tabs and spaces are inserted, depending on whether the global setting is set to use tabs when indenting. The indentation may consist of multiple tab and space characters, depending on the number of spaces a tab equals in the global setting.

If Count is negative, then Indent performs similarly to Unindent.

Indent fails if Count is greater than or equal to 10,000.

Examples

Sub IndentExample()
  ' Before running this example, open a text document.
  Dim objTD As TextDocument
  Dim objEP As EditPoint

  objTD = DTE.ActiveDocument.Object("TextDocument")
  objEP = objTD.StartPoint.CreateEditPoint
  objEP.Indent(,5)
End Sub

.NET Framework Security

See Also

Reference

EditPoint Interface

EnvDTE Namespace