提交 c307d736 编写于 作者: S Salvador Cabrera Lozano 提交者: Matt Bierner

Fix for #26659. (#80227)

* Fix for #26659.

Clicking on a  local file link will open up the editor on a separate editor group (new or reuse existing one).

* Fix for #26659: Add way to open Markdown links in a different editor group

Adding "markdown.editor.openMarkdownLinks" setting to specify where
links to markdown files should open (current editor group by default).
上级 db9733d1
......@@ -269,6 +269,20 @@
"%configuration.markdown.preview.openMarkdownLinks.inEditor%"
]
},
"markdown.editor.openMarkdownLinks": {
"type": "string",
"default": "currentGroup",
"description": "%configuration.markdown.editor.openMarkdownLinks.description%",
"scope": "resource",
"enum": [
"currentGroup",
"openToSide"
],
"enumDescriptions": [
"%configuration.markdown.editor.openMarkdownLinks.inCurrentGroup%",
"%configuration.markdown.editor.openMarkdownLinks.openToSide%"
]
},
"markdown.trace": {
"type": "string",
"enum": [
......
......@@ -23,5 +23,8 @@
"markdown.preview.toggleLock.title": "Toggle Preview Locking",
"configuration.markdown.preview.openMarkdownLinks.description": "How should clicking on links to markdown files be handled in the preview.",
"configuration.markdown.preview.openMarkdownLinks.inEditor": "Try to open links in the editor",
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the markdown preview"
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the markdown preview",
"configuration.markdown.editor.openMarkdownLinks.description": "How following links to markdown files be handled in the editor.",
"configuration.markdown.editor.openMarkdownLinks.inCurrentGroup": "Try to open links in the current editor group",
"configuration.markdown.editor.openMarkdownLinks.openToSide": "Try to open links to the Side"
}
......@@ -52,8 +52,22 @@ export class OpenDocumentLinkCommand implements Command {
return this.tryRevealLine(vscode.window.activeTextEditor, args.fragment);
}
}
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;
}
return vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(document => vscode.window.showTextDocument(document, column))
.then(editor => this.tryRevealLine(editor, args.fragment));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册