Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SwitchHeaderSource use workbench.editor.revealIfOpen setting #8857

Merged
merged 10 commits into from
Feb 18, 2022
18 changes: 11 additions & 7 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,18 @@ async function onSwitchHeaderSource(): Promise<void> {
}
});
const document: vscode.TextDocument = await vscode.workspace.openTextDocument(targetFileName);
const workbenchConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("workbench");
let foundEditor: boolean = false;
// If the document is already visible in another column, open it there.
vscode.window.visibleTextEditors.forEach((editor, index, array) => {
if (editor.document === document && !foundEditor) {
foundEditor = true;
vscode.window.showTextDocument(document, editor.viewColumn);
}
});
if (workbenchConfig.get("editor.revealIfOpen")) {
// If the document is already visible in another column, open it there.
vscode.window.visibleTextEditors.forEach(editor => {
if (editor.document === document && !foundEditor) {
foundEditor = true;
vscode.window.showTextDocument(document, editor.viewColumn);
}
});
}

if (!foundEditor) {
vscode.window.showTextDocument(document);
}
Expand Down