From 6c4e0d8a50210a5bee6ba97e188fc50394740e83 Mon Sep 17 00:00:00 2001 From: chemzqm Date: Fri, 9 Nov 2018 09:59:55 +0800 Subject: [PATCH] not throw error for No content available. --- src/server/features/completionItemProvider.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/server/features/completionItemProvider.ts b/src/server/features/completionItemProvider.ts index aff75c4..77cf98f 100644 --- a/src/server/features/completionItemProvider.ts +++ b/src/server/features/completionItemProvider.ts @@ -118,12 +118,19 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP let isNewIdentifierLocation = true if (this.client.apiVersion.gte(API.v300)) { - const response = await this.client.execute('completionInfo', args, token) - if (response.type !== 'response' || !response.body) { - return null + try { + const response = await this.client.execute('completionInfo', args, token) + if (response.type !== 'response' || !response.body) { + return null + } + isNewIdentifierLocation = response.body.isNewIdentifierLocation + msg = response.body.entries + } catch (e) { + if (e.message == 'No content available.') { + return null + } + throw e } - isNewIdentifierLocation = response.body.isNewIdentifierLocation - msg = response.body.entries } else { const response = await this.client.execute('completions', args, token) msg = response.body