Skip to content

Commit e2b2b78

Browse files
authored
Switch to open instead of focus on run (#601)
1 parent 0193519 commit e2b2b78

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

packages/vscode-extension/src/registrationService.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,18 @@ export function registerDisposables(): Disposable[] {
4444
const queryDetailsProvider = new Neo4jQueryDetailsProvider();
4545
const queryVisualizationProvider = new Neo4jQueryVisualizationProvider();
4646
const renderBottomPanel = async (statements: string[]) => {
47-
await commands.executeCommand('neo4jQueryDetails.focus');
48-
await commands.executeCommand('neo4jQueryVisualization.focus');
47+
try {
48+
await commands.executeCommand('neo4jQueryDetails.open', {
49+
preserveFocus: true,
50+
});
51+
await commands.executeCommand('neo4jQueryVisualization.open', {
52+
preserveFocus: true,
53+
});
54+
} catch (e) {
55+
/* no-op */
56+
//If a user (or a test framework) has an old version of vscode, <webview>.open won't exist
57+
//A user can still open the webview manually, so we prefer not to remove focus from the editor
58+
}
4959
await queryVisualizationProvider.viewReadyPromise;
5060
await queryDetailsProvider.executeStatements(statements);
5161
};

packages/vscode-extension/tests/specs/webviews/params.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ suite('Params panel testing', () => {
5454

5555
before(async () => {
5656
workbench = await browser.getWorkbench();
57-
await workbench.executeCommand(
58-
'Query Results: Focus on Query Details View',
59-
);
57+
await workbench.executeCommand('neo4jQueryDetails.focus');
58+
await workbench.executeCommand('neo4jQueryVisualization.focus');
6059
});
6160

6261
async function escapeModal(count: number) {

0 commit comments

Comments
 (0)