Interface CompletionItemProvider

Expand description

The completion item provider interface defines the contract between extensions and the IntelliSense.

When computing complete completion items is expensive, providers can optionally implement the resolveCompletionItem-function. In that case it is enough to return completion items with a label from the provideCompletionItems-function. Subsequently, when a completion item is shown in the UI and gains focus this provider is asked to resolve the item, like adding doc-comment or details.

interface CompletionItemProvider {
    triggerCharacters?: string[];
    provideCompletionItems(
        model: ITextModel,
        position: Position,
        context: CompletionContext,
        token: CancellationToken,
    ): ProviderResult<CompletionList>;
    resolveCompletionItem?(
        item: CompletionItem,
        token: CancellationToken,
    ): ProviderResult<CompletionItem>;
}

Properties§

§triggerCharacters?: string[]

Methods§

§

provideCompletionItems(
    model: ITextModel,
    position: Position,
    context: CompletionContext,
    token: CancellationToken,
): ProviderResult<CompletionList>

Provide completion items for the given position and document.

§

resolveCompletionItem?(
    item: CompletionItem,
    token: CancellationToken,
): ProviderResult<CompletionItem>

Given a completion item fill in more data, like doc-comment or details.

The editor will only resolve a completion item once.