fix error thrown on highlight
This commit is contained in:
parent
2f02125d73
commit
27887574ef
1 changed files with 11 additions and 8 deletions
|
@ -24,16 +24,19 @@ export default class TypeScriptDocumentHighlightProvider implements DocumentHigh
|
|||
...typeConverters.Position.toFileLocationRequestArgs(file, position),
|
||||
filesToSearch: [file]
|
||||
}
|
||||
const response = await this.client.execute('documentHighlights', args, token)
|
||||
if (response.type !== 'response' || !response.body) {
|
||||
try {
|
||||
const response = await this.client.execute('documentHighlights', args, token)
|
||||
if (response.type !== 'response' || !response.body) {
|
||||
return []
|
||||
}
|
||||
return flatten(
|
||||
response.body
|
||||
.filter(highlight => highlight.file === file)
|
||||
.map(convertDocumentHighlight))
|
||||
|
||||
} catch (_e) {
|
||||
return []
|
||||
}
|
||||
|
||||
return flatten(
|
||||
response.body
|
||||
.filter(highlight => highlight.file === file)
|
||||
.map(convertDocumentHighlight))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue