提交 ebfd5dc4 编写于 作者: M Matt Bierner

Revert c585fc65

Fixes #39857
上级 0a55bde2
......@@ -138,18 +138,17 @@ export class MarkdownEngine {
md.normalizeLink = (link: string) => {
try {
let uri = vscode.Uri.parse(link);
if (!uri.scheme && uri.path) {
let p = uri.path;
if (!uri.scheme && uri.path && !uri.fragment) {
// Assume it must be a file
if (p[0] === '/') {
if (uri.path[0] === '/') {
const root = vscode.workspace.getWorkspaceFolder(this.currentDocument);
if (root) {
p = path.join(root.uri.fsPath, uri.path);
uri = vscode.Uri.file(path.join(root.uri.fsPath, uri.path));
}
} else {
p = path.join(path.dirname(this.currentDocument.path), uri.path);
uri = vscode.Uri.file(path.join(path.dirname(this.currentDocument.path), uri.path));
}
return OpenDocumentLinkCommand.createCommandUri(p, uri.fragment).toString();
return normalizeLink(uri.toString(true));
}
} catch (e) {
// noop
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册