In This Article

ITextFormatter Interface

Provides the base requirements of a language formatter that can adjust the whitespace layout of text for better readability.

public interface ITextFormatter

Remarks

This interface type can be registered with an ISyntaxLanguage using the RegisterService(object, object) method. Once an object that implements this interface is registered with the language for this interface type, its features can be used by the language.

Methods

Format(ITextSnapshot, ITextPositionRangeCollection, TextFormatMode)

Applies text formatting to part or all of a snapshot.

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.