Interface DocumentRangeFormattingEditProvider

Expand description

The document formatting provider interface defines the contract between extensions and the formatting-feature.

interface DocumentRangeFormattingEditProvider {
    displayName?: string;
    provideDocumentRangeFormattingEdits(
        model: ITextModel,
        range: Range,
        options: FormattingOptions,
        token: CancellationToken,
    ): ProviderResult<TextEdit[]>;
    provideDocumentRangesFormattingEdits?(
        model: ITextModel,
        ranges: Range[],
        options: FormattingOptions,
        token: CancellationToken,
    ): ProviderResult<TextEdit[]>;
}

Properties§

§readonly displayName?: string

Methods§

§

provideDocumentRangeFormattingEdits(
    model: ITextModel,
    range: Range,
    options: FormattingOptions,
    token: CancellationToken,
): ProviderResult<TextEdit[]>

Provide formatting edits for a range in a document.

The given range is a hint and providers can decide to format a smaller or larger range. Often this is done by adjusting the start and end of the range to full syntax nodes.

§

provideDocumentRangesFormattingEdits?(
    model: ITextModel,
    ranges: Range[],
    options: FormattingOptions,
    token: CancellationToken,
): ProviderResult<TextEdit[]>