mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Extract
This commit is contained in:
@@ -53,24 +53,24 @@ export class OpenDocumentLinkCommand implements Command {
|
||||
}
|
||||
}
|
||||
|
||||
const config = vscode.workspace.getConfiguration('markdown', resource);
|
||||
const openLinks = config.get<string>('editor.openMarkdownLinks', 'currentGroup');
|
||||
|
||||
let column: vscode.ViewColumn;
|
||||
switch (openLinks) {
|
||||
case 'openToSide':
|
||||
column = vscode.ViewColumn.Beside;
|
||||
break;
|
||||
case 'currentGroup':
|
||||
default:
|
||||
column = vscode.ViewColumn.Active;
|
||||
}
|
||||
|
||||
const column = this.getViewColumn(resource);
|
||||
return vscode.workspace.openTextDocument(resource)
|
||||
.then(document => vscode.window.showTextDocument(document, column))
|
||||
.then(editor => this.tryRevealLine(editor, args.fragment));
|
||||
}
|
||||
|
||||
private getViewColumn(resource: vscode.Uri): vscode.ViewColumn {
|
||||
const config = vscode.workspace.getConfiguration('markdown', resource);
|
||||
const openLinks = config.get<string>('editor.openMarkdownLinks', 'currentGroup');
|
||||
switch (openLinks) {
|
||||
case 'openToSide':
|
||||
return vscode.ViewColumn.Beside;
|
||||
case 'currentGroup':
|
||||
default:
|
||||
return vscode.ViewColumn.Active;
|
||||
}
|
||||
}
|
||||
|
||||
private async tryRevealLine(editor: vscode.TextEditor, fragment?: string) {
|
||||
if (editor && fragment) {
|
||||
const toc = new TableOfContentsProvider(this.engine, editor.document);
|
||||
|
||||
Reference in New Issue
Block a user