From a62afe6595f2f790b67b8416063deb39de8e2c2a Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Thu, 11 Apr 2024 15:36:03 +0100 Subject: [PATCH] fix: make sure old fix panels are closed on startup --- .../suggestion/codeSuggestionWebviewProvider.ts | 2 +- src/snyk/snykCode/views/webviewPanelSerializer.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/snyk/snykCode/views/webviewPanelSerializer.ts diff --git a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts index 3d78a2215..87d9e8f8d 100644 --- a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts +++ b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts @@ -31,7 +31,7 @@ import { ICodeSuggestionWebviewProvider } from '../interfaces'; import { readFileSync } from 'fs'; import { TextDocument } from '../../../common/vscode/types'; import { Suggestion, SuggestionMessage } from './types'; -import { WebviewPanelSerializer } from '../../../common/views/webviewPanelSerializer'; +import { WebviewPanelSerializer } from '../../../snykCode/views/webviewPanelSerializer'; export class CodeSuggestionWebviewProvider extends WebviewProvider> diff --git a/src/snyk/snykCode/views/webviewPanelSerializer.ts b/src/snyk/snykCode/views/webviewPanelSerializer.ts new file mode 100644 index 000000000..4efcd11f3 --- /dev/null +++ b/src/snyk/snykCode/views/webviewPanelSerializer.ts @@ -0,0 +1,12 @@ +import * as vscode from 'vscode'; +import { WebviewProvider } from '../../../snyk/common/views/webviewProvider'; +import { Logger } from '../../common/logger/logger'; + +export class WebviewPanelSerializer, State> implements vscode.WebviewPanelSerializer { + constructor(private readonly provider: Provider) {} + async deserializeWebviewPanel(webviewPanel: vscode.WebviewPanel): Promise { + // we want to make sure the panel is closed on startup + webviewPanel.dispose(); + return Promise.resolve(); + } +}