提交 3afaa9d9 编写于 作者: M Matt Bierner

Support for wiki links in the markdown editor

Fixes #37400
上级 1f4ec255
......@@ -157,14 +157,25 @@ export function activate(context: vscode.ExtensionContext) {
}
}
};
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === args.path) {
return tryRevealLine(vscode.window.activeTextEditor);
} else {
const tryOpen = async (path: string) => {
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === path) {
return tryRevealLine(vscode.window.activeTextEditor);
} else {
const resource = vscode.Uri.file(path);
return vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(tryRevealLine);
}
};
return tryOpen(args.path).catch(() => {
if (path.extname(args.path) === '') {
return tryOpen(args.path + '.md');
}
const resource = vscode.Uri.file(args.path);
return vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(tryRevealLine, _ => vscode.commands.executeCommand('vscode.open', resource));
}
return vscode.commands.executeCommand('vscode.open', resource);
});
}));
context.subscriptions.push(vscode.commands.registerCommand('markdown.showPreviewSecuritySelector', (resource: string | undefined) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册