Use clearer logic

pull/147470/head
Matt Bierner 2022-04-05 12:55:23 -07:00
parent f97316f0c3
commit 9b141e1959
No known key found for this signature in database
GPG Key ID: 099C331567E11888
1 changed files with 12 additions and 10 deletions

View File

@ -248,17 +248,19 @@ export class MdReferencesProvider extends Disposable implements vscode.Reference
}
// Exclude cases where the file is implicitly referencing itself
if (!link.source.text.startsWith('#') || link.source.resource.fsPath !== resource.fsPath) {
const isTriggerLocation = !!sourceLink && sourceLink.source.resource.fsPath === link.source.resource.fsPath && sourceLink.source.hrefRange.isEqual(link.source.hrefRange);
yield {
kind: 'link',
isTriggerLocation,
isDefinition: false,
link,
location: new vscode.Location(link.source.resource, link.source.hrefRange),
fragmentLocation: getFragmentLocation(link),
};
if (link.source.text.startsWith('#') && link.source.resource.fsPath === resource.fsPath) {
continue;
}
const isTriggerLocation = !!sourceLink && sourceLink.source.resource.fsPath === link.source.resource.fsPath && sourceLink.source.hrefRange.isEqual(link.source.hrefRange);
yield {
kind: 'link',
isTriggerLocation,
isDefinition: false,
link,
location: new vscode.Location(link.source.resource, link.source.hrefRange),
fragmentLocation: getFragmentLocation(link),
};
}
}