* Fixes #147896

* Replace all

* Fix windows slash check

* Skip test on windows for now
This commit is contained in:
Matt Bierner
2022-04-26 15:45:15 -04:00
committed by GitHub
parent cf264c89b0
commit c41728c479
2 changed files with 5 additions and 4 deletions

View File

@@ -182,11 +182,11 @@ export class MdRenameProvider extends Disposable implements vscode.RenameProvide
newPath = '/' + path.relative(root.toString(true), rawNewFilePath.toString(true));
} else {
newPath = path.relative(URI.Utils.dirname(ref.link.source.resource).toString(true), rawNewFilePath.toString(true));
if (newName.startsWith('./') && !newPath.startsWith('../')) {
if (newName.startsWith('./') && !newPath.startsWith('../') || newName.startsWith('.\\') && !newPath.startsWith('..\\')) {
newPath = './' + newPath;
}
}
edit.replace(ref.link.source.resource, this.getFilePathRange(ref), encodeURI(newPath));
edit.replace(ref.link.source.resource, this.getFilePathRange(ref), encodeURI(newPath.replace(/\\/g, '/')));
}
}