Skip to content

Commit 111a653

Browse files
authored
Make SwitchHeaderSource use workbench.editor.revealIfOpen setting (#8857)
Make SwitchHeaderSource use workbench.editor.revealIfOpen setting
1 parent fcd74cb commit 111a653

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Extension/src/LanguageServer/extension.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,18 @@ async function onSwitchHeaderSource(): Promise<void> {
484484
}
485485
});
486486
const document: vscode.TextDocument = await vscode.workspace.openTextDocument(targetFileName);
487+
const workbenchConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("workbench");
487488
let foundEditor: boolean = false;
488-
// If the document is already visible in another column, open it there.
489-
vscode.window.visibleTextEditors.forEach((editor, index, array) => {
490-
if (editor.document === document && !foundEditor) {
491-
foundEditor = true;
492-
vscode.window.showTextDocument(document, editor.viewColumn);
493-
}
494-
});
489+
if (workbenchConfig.get("editor.revealIfOpen")) {
490+
// If the document is already visible in another column, open it there.
491+
vscode.window.visibleTextEditors.forEach(editor => {
492+
if (editor.document === document && !foundEditor) {
493+
foundEditor = true;
494+
vscode.window.showTextDocument(document, editor.viewColumn);
495+
}
496+
});
497+
}
498+
495499
if (!foundEditor) {
496500
vscode.window.showTextDocument(document);
497501
}

0 commit comments

Comments
 (0)