Skip to content

Commit

Permalink
fix: don't trigger error on empty Source Definition response (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Aug 21, 2022
1 parent 195595d commit 146a6ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/features/source-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ export class SourceDefinitionCommand {
reporter,
}, async () => {
const response = await tspClient.request(CommandTypes.FindSourceDefinition, args);
if (response.type === 'response' && response.body?.length) {
return response.body.map(reference => toLocation(reference, documents));
if (response.type !== 'response' || !response.body) {
lspClient.showErrorMessage('No source definitions found.');
return;
}
lspClient.showErrorMessage('No source definitions found.');
return response.body.map(reference => toLocation(reference, documents));
});
}
}

0 comments on commit 146a6ba

Please sign in to comment.