Adding test for renaming the definition itself

This commit is contained in:
Matt Bierner
2022-04-04 15:02:58 -07:00
parent 7831ff6a32
commit d0767451a9
2 changed files with 27 additions and 6 deletions

View File

@@ -93,12 +93,10 @@ export class MdRenameProvider extends Disposable implements vscode.RenameProvide
// We may be renaming either the reference or the definition itself
if (isRefRename) {
edit.replace(ref.link.source.resource, ref.link.ref.range, newName);
} else {
edit.replace(ref.link.source.resource, ref.fragmentLocation?.range ?? ref.link.source.hrefRange, ref.fragmentLocation ? slug : newName);
continue;
}
} else {
edit.replace(ref.location.uri, ref.fragmentLocation?.range ?? ref.location.range, ref.link.href.kind === 'reference' ? newName : slug);
}
edit.replace(ref.link.source.resource, ref.fragmentLocation?.range ?? ref.location.range, isRefRename && !ref.fragmentLocation ? newName : slug);
break;
}
}