Interface InlineCompletionsProvider<T>

interface InlineCompletionsProvider<
    T extends InlineCompletions = InlineCompletions,
> {
    debounceDelayMs?: number;
    displayName?: string;
    excludesGroupIds?: string[];
    groupId?: string;
    onDidChangeInlineCompletions?: IEvent<void>;
    yieldsToGroupIds?: string[];
    disposeInlineCompletions(
        completions: T,
        reason: InlineCompletionsDisposeReason,
    ): void;
    handleEndOfLifetime?(
        completions: T,
        item: T["items"][number],
        reason: InlineCompletionEndOfLifeReason<
            T["items"][number],
        >,
        lifetimeSummary: LifetimeSummary,
    ): void;
    handleItemDidShow?(
        completions: T,
        item: T["items"][number],
        updatedInsertText: string,
        editDeltaInfo: EditDeltaInfo,
    ): void;
    handlePartialAccept?(
        completions: T,
        item: T["items"][number],
        acceptedCharacters: number,
        info: PartialAcceptInfo,
    ): void;
    handleRejection?(
        completions: T,
        item: T["items"][number],
    ): void;
    provideInlineCompletions(
        model: ITextModel,
        position: Position,
        context: InlineCompletionContext,
        token: CancellationToken,
    ): ProviderResult<T>;
    toString?(): string;
}

Properties§

§debounceDelayMs?: number
§displayName?: string
§excludesGroupIds?: string[]
§groupId?: string

Only used for yieldsToGroupIds. Multiple providers can have the same group id.

§onDidChangeInlineCompletions?: IEvent<void>
§yieldsToGroupIds?: string[]

Returns a list of preferred provider groupIds. The current provider is only requested for completions if no provider with a preferred group id returned a result.

Methods§

§

disposeInlineCompletions(
    completions: T,
    reason: InlineCompletionsDisposeReason,
): void

Will be called when a completions list is no longer in use and can be garbage-collected.

§

handleEndOfLifetime?(
    completions: T,
    item: T["items"][number],
    reason: InlineCompletionEndOfLifeReason<
        T["items"][number],
    >,
    lifetimeSummary: LifetimeSummary,
): void

Is called when an inline completion item is no longer being used. Provides a reason of why it is not used anymore.

§

handleItemDidShow?(
    completions: T,
    item: T["items"][number],
    updatedInsertText: string,
    editDeltaInfo: EditDeltaInfo,
): void

Will be called when an item is shown.

§

handlePartialAccept?(
    completions: T,
    item: T["items"][number],
    acceptedCharacters: number,
    info: PartialAcceptInfo,
): void

Will be called when an item is partially accepted. TODO: also handle full acceptance here!

§

handleRejection?(
    completions: T,
    item: T["items"][number],
): void

deprecated

Use handleEndOfLifetime instead.

§

provideInlineCompletions(
    model: ITextModel,
    position: Position,
    context: InlineCompletionContext,
    token: CancellationToken,
): ProviderResult<T>

§

toString?(): string