Skip to content

Commit df16d1a

Browse files
committed
Results view: Don't reopen webview if it's already visible
1 parent b661b2b commit df16d1a

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

extensions/ql-vscode/src/interface.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -379,27 +379,29 @@ export class InterfaceManager extends DisposableObject {
379379

380380
const panel = this.getPanel();
381381
await this.waitForPanelLoaded();
382-
if (forceReveal === WebviewReveal.Forced) {
383-
panel.reveal(undefined, true);
384-
} else if (!panel.visible) {
385-
// The results panel exists, (`.getPanel()` guarantees it) but
386-
// is not visible; it's in a not-currently-viewed tab. Show a
387-
// more asynchronous message to not so abruptly interrupt
388-
// user's workflow by immediately revealing the panel.
389-
const showButton = 'View Results';
390-
const queryName = results.queryName;
391-
const resultPromise = vscode.window.showInformationMessage(
392-
`Finished running query ${queryName.length > 0 ? ` "${queryName}"` : ''
393-
}.`,
394-
showButton
395-
);
396-
// Address this click asynchronously so we still update the
397-
// query history immediately.
398-
void resultPromise.then((result) => {
399-
if (result === showButton) {
400-
panel.reveal();
401-
}
402-
});
382+
if (!panel.visible) {
383+
if (forceReveal === WebviewReveal.Forced) {
384+
panel.reveal(undefined, true);
385+
} else {
386+
// The results panel exists, (`.getPanel()` guarantees it) but
387+
// is not visible; it's in a not-currently-viewed tab. Show a
388+
// more asynchronous message to not so abruptly interrupt
389+
// user's workflow by immediately revealing the panel.
390+
const showButton = 'View Results';
391+
const queryName = results.queryName;
392+
const resultPromise = vscode.window.showInformationMessage(
393+
`Finished running query ${queryName.length > 0 ? ` "${queryName}"` : ''
394+
}.`,
395+
showButton
396+
);
397+
// Address this click asynchronously so we still update the
398+
// query history immediately.
399+
void resultPromise.then((result) => {
400+
if (result === showButton) {
401+
panel.reveal();
402+
}
403+
});
404+
}
403405
}
404406

405407
// Note that the resultSetSchemas will return offsets for the default (unsorted) page,

0 commit comments

Comments
 (0)