Interface OnTypeFormattingEditProvider

Expand description

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

interface OnTypeFormattingEditProvider {
    autoFormatTriggerCharacters: string[];
    provideOnTypeFormattingEdits(
        model: ITextModel,
        position: Position,
        ch: string,
        options: FormattingOptions,
        token: CancellationToken,
    ): ProviderResult<TextEdit[]>;
}

Properties§

§autoFormatTriggerCharacters: string[]

Methods§

§

provideOnTypeFormattingEdits(
    model: ITextModel,
    position: Position,
    ch: string,
    options: FormattingOptions,
    token: CancellationToken,
): ProviderResult<TextEdit[]>

Provide formatting edits after a character has been typed.

The given position and character should hint to the provider what range the position to expand to, like find the matching { when } has been entered.