Theia API Documentation v1.65.0
    Preparing search index...

    The code action interface defines the contract between extensions and the light bulb feature.

    A code action can be any command that is known to the system.

    interface CodeActionProvider<T extends CodeAction = CodeAction> {
        provideCodeActions(
            document: TextDocument,
            range: Selection | Range,
            context: CodeActionContext,
            token: CancellationToken,
        ): ProviderResult<(Command | T)[]>;
        resolveCodeAction?(
            codeAction: T,
            token: CancellationToken,
        ): ProviderResult<T>;
    }

    Type Parameters

    Index

    Methods

    • Given a code action fill in its edit-property. Changes to all other properties, like title, are ignored. A code action that has an edit will not be resolved.

      Note that a code action provider that returns commands, not code actions, cannot successfully implement this function. Returning commands is deprecated and instead code actions should be returned.

      Parameters

      Returns ProviderResult<T>

      The resolved code action or a thenable that resolves to such. It is OK to return the given item. When no result is returned, the given item will be used.