Use destructuring

This commit is contained in:
Matt Bierner
2018-07-11 16:04:35 -07:00
parent 23d9f2cea6
commit 659d646e55

View File

@@ -309,20 +309,17 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
let msg: ReadonlyArray<Proto.CompletionEntry> | undefined = undefined;
try {
if (this.client.apiVersion.gte(API.v300)) {
const response = await this.client.execute('completionInfo', args, token);
if (!response.body) {
const { body } = await this.client.execute('completionInfo', args, token);
if (!body || body.isNewIdentifierLocation) {
return null;
}
if (response.body.isNewIdentifierLocation) {
return null;
}
msg = response.body.entries;
msg = body.entries;
} else {
const response = await this.client.execute('completions', args, token);
if (!response.body) {
const { body } = await this.client.execute('completions', args, token);
if (!body) {
return null;
}
msg = response.body;
msg = body;
}
} catch {
return null;