From f30ee2c2cd076cd109ef190c8c759045b719b6ce Mon Sep 17 00:00:00 2001 From: worksofliam Date: Tue, 5 Dec 2023 10:21:20 -0500 Subject: [PATCH] Reset the results view on disconnect --- src/config.ts | 2 ++ src/views/results/index.ts | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index c55b7987..f8bbe267 100644 --- a/src/config.ts +++ b/src/config.ts @@ -71,6 +71,8 @@ export function setupConfig(context: ExtensionContext) { // Remove old service examples delete Examples[ServiceInfoLabel]; + + await commands.executeCommand(`vscode-db2i.resultset.reset`); }); } diff --git a/src/views/results/index.ts b/src/views/results/index.ts index be191a90..16356c83 100644 --- a/src/views/results/index.ts +++ b/src/views/results/index.ts @@ -95,7 +95,7 @@ class ResultSetPanelProvider { } } - async setLoadingText(content) { + async setLoadingText(content: string) { await this.focus(); if (!this.loadingState) { @@ -148,6 +148,11 @@ export function initialise(context: vscode.ExtensionContext) { webviewOptions: { retainContextWhenHidden: true }, }), + vscode.commands.registerCommand(`vscode-db2i.resultset.reset`, async () => { + resultSetProvider.loadingState = false; + resultSetProvider.setLoadingText(`View will be active when a statement is executed.`); + }), + vscode.commands.registerCommand(`vscode-db2i.runEditorStatement`, async (options?: StatementInfo) => { // Options here can be a vscode.Uri when called from editor context.