Fix optionalReplacementSpan not being applied to completion entries (#200945)

* Fix optionalReplacementSpan not being applied to completion entries

* Format completions.ts
This commit is contained in:
Johnson Chu 2024-01-04 06:40:11 +08:00 committed by GitHub
parent eb55c74a90
commit 40c0f939e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -760,6 +760,12 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider<
isIncomplete = !!response.body.isIncomplete || (response as any).metadata && (response as any).metadata.isIncomplete;
entries = response.body.entries;
metadata = response.metadata;
if (response.body.optionalReplacementSpan) {
for (const entry of entries) {
entry.replacementSpan ??= response.body.optionalReplacementSpan;
}
}
} else {
const response = await this.client.interruptGetErr(() => this.client.execute('completions', args, token));
if (response.type !== 'response' || !response.body) {