diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index ca19cdc010c..8ed1d005b1a 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1594,7 +1594,10 @@ export class CompletionList { @es5ClassCompat export class InlineSuggestion implements vscode.InlineCompletionItem { - insertText?: string; + + insertText?: string | SnippetString; + + filterText?: string; /** * @deprecated Use `insertText` instead. Will be removed eventually. @@ -1604,7 +1607,7 @@ export class InlineSuggestion implements vscode.InlineCompletionItem { range?: Range; command?: vscode.Command; - constructor(insertText: string, range?: Range, command?: vscode.Command) { + constructor(insertText: string | SnippetString, range?: Range, command?: vscode.Command) { this.insertText = insertText; this.range = range; this.command = command; diff --git a/src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts b/src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts index 7855c4b4ea4..a04cde81a20 100644 --- a/src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts +++ b/src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts @@ -9,16 +9,24 @@ declare module 'vscode' { // Temporary API to allow for safe migration. export namespace languages { + /** * Registers an inline completion provider. * - * @return A {@link Disposable} that unregisters this provider when being disposed. + * Multiple providers can be registered for a language. In that case providers are asked in + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. + * + * @param selector A selector that defines the documents this provider is applicable to. + * @param provider A inline completion provider. + * @return A {@link Disposable} that unregisters this provider when being disposed. */ - // TODO@API what are the rules when multiple providers apply export function registerInlineCompletionItemProviderNew(selector: DocumentSelector, provider: InlineCompletionItemProviderNew): Disposable; } + // TODO@API doc export interface InlineCompletionItemProviderNew { + /** * Provides inline completion items for the given position and document. * If inline completions are enabled, this method will be called whenever the user stopped typing. @@ -28,6 +36,7 @@ declare module 'vscode' { provideInlineCompletionItems(document: TextDocument, position: Position, context: InlineCompletionContextNew, token: CancellationToken): ProviderResult; } + // TODO@API doc export interface InlineCompletionContextNew { /** * How the completion was triggered. @@ -50,6 +59,7 @@ declare module 'vscode' { } // TODO@API find a better name, xyzFilter, xyzConstraint + // TODO@API doc export interface SelectedCompletionInfoNew { range: Range; text: string; @@ -126,7 +136,7 @@ declare module 'vscode' { */ command?: Command; - // TODO@API insertText -> string | SnippetString - constructor(insertText: string, range?: Range, command?: Command); + // TODO@API doc + constructor(insertText: string | SnippetString, range?: Range, command?: Command); } }