Interface InvertConditionProvider<T>

A provider that can be registered to handle the inversion of conditions.

interface InvertConditionProvider<T> {
    provideConditions(
        context: DocumentContext,
        range?: Range,
    ): ProviderResult<RefSyntaxNode<T>[]>;
    replaceCondition(
        context: DocumentContext,
        edit: TextEditorEdit,
        original: RefSyntaxNode<T>,
        replace: UpdatedSyntaxNode<T>,
    ): void;
    resolveCondition(
        context: DocumentContext,
        condition: RefSyntaxNode<T>,
    ): ProviderResult<RefSyntaxNode<T>>;
}

Type Parameters

  • T

Hierarchy (View Summary)

Methods

  • Provide conditions for the given document and range. Only top-level conditions should be returned.

    Parameters

    • context: DocumentContext

      The context of the document for which to provide conditions

    • Optionalrange: Range

      The range for which to provide conditions (the range may refer to a range inside an embedded section

    Returns ProviderResult<RefSyntaxNode<T>[]>

    A list of conditions with references to the original syntax nodes

    // Given the following code:
    if ((a && b) || c) {
    d();
    if (e) f();
    }

    // The following conditions should be returned:
    (a && b || c9
    e

    DocumentContext)