提交 789fa539 编写于 作者: M Matt Bierner

Fix markdown links no opening

上级 94391ea1
......@@ -20,6 +20,11 @@ interface IPackageInfo {
aiKey: string;
}
interface OpenDocumentLinkArgs {
path: string;
fragment: string;
}
var telemetryReporter: TelemetryReporter | null;
export function activate(context: vscode.ExtensionContext) {
......@@ -70,7 +75,7 @@ export function activate(context: vscode.ExtensionContext) {
});
}));
context.subscriptions.push(vscode.commands.registerCommand('_markdown.openDocumentLink', (args) => {
context.subscriptions.push(vscode.commands.registerCommand('_markdown.openDocumentLink', (args: OpenDocumentLinkArgs) => {
const tryRevealLine = (editor: vscode.TextEditor) => {
if (editor && args.fragment) {
const toc = new TableOfContentProvider(engine, editor.document);
......@@ -82,10 +87,10 @@ export function activate(context: vscode.ExtensionContext) {
}
}
};
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === args.fsPath) {
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === args.path) {
return tryRevealLine(vscode.window.activeTextEditor);
} else {
const resource = vscode.Uri.file(args.fsPath);
const resource = vscode.Uri.file(args.path);
vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(tryRevealLine, _ => vscode.commands.executeCommand('vscode.open', resource));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册