mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Prefer reusing open tabs when opening md links in editors (#178628)
Fixes #81238
This commit is contained in:
parent
af5ef24b52
commit
7a463ec271
|
@ -37,6 +37,18 @@ export class MdLinkOpener {
|
|||
return vscode.commands.executeCommand('revealInExplorer', uri);
|
||||
|
||||
case 'file': {
|
||||
// If no explicit viewColumn is given, check if the editor is already open in a tab
|
||||
if (typeof viewColumn === 'undefined') {
|
||||
for (const tab of vscode.window.tabGroups.all.flatMap(x => x.tabs)) {
|
||||
if (tab.input instanceof vscode.TabInputText) {
|
||||
if (tab.input.uri.fsPath === uri.fsPath) {
|
||||
viewColumn = tab.group.viewColumn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vscode.commands.executeCommand('vscode.open', uri, <vscode.TextDocumentShowOptions>{
|
||||
selection: resolved.position ? new vscode.Range(resolved.position.line, resolved.position.character, resolved.position.line, resolved.position.character) : undefined,
|
||||
viewColumn: viewColumn ?? getViewColumn(fromResource),
|
||||
|
|
Loading…
Reference in a new issue