diff --git a/extensions/typescript-language-features/src/features/completions.ts b/extensions/typescript-language-features/src/features/completions.ts index 79f49915d25fa..a4e1448098af9 100644 --- a/extensions/typescript-language-features/src/features/completions.ts +++ b/extensions/typescript-language-features/src/features/completions.ts @@ -329,9 +329,9 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext - ): Promise { + ): Promise { if (this.typingsStatus.isAcquiringTypings) { - return Promise.reject({ + return Promise.reject({ label: localize( { key: 'acquiringTypingsLabel', comment: ['Typings refers to the *.d.ts typings files that power our IntelliSense. It should not be localized'] }, 'Acquiring typings...'), @@ -363,13 +363,15 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider }; let isNewIdentifierLocation = true; - let msg: ReadonlyArray | undefined = undefined; + let isIncomplete = false; + let msg: ReadonlyArray; if (this.client.apiVersion.gte(API.v300)) { const response = await this.client.interuptGetErr(() => this.client.execute('completionInfo', args, token)); if (response.type !== 'response' || !response.body) { return null; } isNewIdentifierLocation = response.body.isNewIdentifierLocation; + isIncomplete = (response as any).metadata && (response as any).metadata.isIncomplete; msg = response.body.entries; } else { const response = await this.client.interuptGetErr(() => this.client.execute('completions', args, token)); @@ -381,13 +383,14 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider } const isInValidCommitCharacterContext = this.isInValidCommitCharacterContext(document, position); - return msg + const items = msg .filter(entry => !shouldExcludeCompletionEntry(entry, completionConfiguration)) .map(entry => new MyCompletionItem(position, document, line.text, entry, completionConfiguration.useCodeSnippetsOnMethodSuggest, { isNewIdentifierLocation, isInValidCommitCharacterContext, enableCallCompletions: !completionConfiguration.useCodeSnippetsOnMethodSuggest })); + return new vscode.CompletionList(items, isIncomplete); } private getTsTriggerCharacter(context: vscode.CompletionContext): Proto.CompletionsTriggerCharacter | undefined {