In This Article

JavaScriptTextFormatter Class

Provides a JavaScript language text formatter service.

public class JavaScriptTextFormatter : ITextFormatter
Inheritance:
object object
Implements:
ITextFormatter

Constructors

JavaScriptTextFormatter()

Initializes an instance of the class.

public JavaScriptTextFormatter()

Properties

IsOpeningBraceOnNewLine

Gets or sets a value indicating whether opening braces are on new lines.

public bool IsOpeningBraceOnNewLine { get; set; }

Property Value

bool:

true if the opening braces are on new lines; otherwise, false.

Methods

Format(ITextSnapshot, ITextPositionRangeCollection, TextFormatMode)

Applies text formatting to part or all of a snapshot.

public void Format(ITextSnapshot snapshot, ITextPositionRangeCollection selectionPositionRanges, TextFormatMode mode = TextFormatMode.Ranges)
Parameter Type Description
snapshot ITextSnapshot

The target ITextSnapshot.

selectionPositionRanges ITextPositionRangeCollection

The ITextPositionRangeCollection indicating the selection position ranges. These are used to translate the current selection to the new snapshot that is created, even when formatting the entire snapshot.

mode TextFormatMode

A TextFormatMode indicating whether to format part or all of the snapshot. The default value is Ranges.

Remarks

The containing ITextDocument is accessible via the ITextSnapshot.

Inherited Members