mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:28:52 +01:00
Fix explicit references to own file
This commit is contained in:
@@ -218,8 +218,8 @@ export class MdReferencesProvider extends Disposable implements vscode.Reference
|
||||
}
|
||||
} else { // Triggered on a link without a fragment so we only require matching the file and ignore fragments
|
||||
|
||||
// But exclude cases where the file is referencing itself
|
||||
if (link.sourceResource.fsPath !== targetDoc.uri.fsPath) {
|
||||
// But exclude cases where the file is implicitly referencing itself
|
||||
if (!link.sourceText.startsWith('#') || link.sourceResource.fsPath !== targetDoc.uri.fsPath) {
|
||||
references.push({
|
||||
kind: 'link',
|
||||
isTriggerLocation,
|
||||
|
||||
@@ -56,7 +56,10 @@ export class MdRenameProvider extends Disposable implements vscode.RenameProvide
|
||||
return triggerRef.link.sourceHrefRange;
|
||||
}
|
||||
} else {
|
||||
return triggerRef.fragmentLocation?.range ?? triggerRef.location.range;
|
||||
if (triggerRef.fragmentLocation) {
|
||||
return triggerRef.fragmentLocation.range;
|
||||
}
|
||||
throw new Error(localize('renameNoFiles', "Renaming files is currently not supported"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user