not throw error for No content available.

This commit is contained in:
chemzqm 2018-11-09 09:59:55 +08:00
parent 786cdcd252
commit 6c4e0d8a50

View file

@ -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