From 0a6e508a1bcb5260db0df5e8828cc11668bd6b72 Mon Sep 17 00:00:00 2001 From: Siwar GAROUACHI Date: Thu, 24 Aug 2023 10:31:23 +0200 Subject: [PATCH] fix(extension): wait for the execution of show message --- src/extension.ts | 14 +++++++------- src/lib/runner-factory.ts | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index fd8a5d1..0c60062 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -12,7 +12,7 @@ export async function activate( ): Promise { // Create storageUri if (!context.storageUri) { - vscode.window.showErrorMessage( + await vscode.window.showErrorMessage( `Failed to activate ${MetaReaderFactory.getInstance().getExtensionName()}`, ); return; @@ -26,7 +26,7 @@ export async function activate( ); // Show info message - vscode.window.showInformationMessage( + await vscode.window.showInformationMessage( `${MetaReaderFactory.getInstance().getExtensionName()} is now active!`, ); @@ -85,7 +85,7 @@ export async function scan( .get('credentialDigger'); if (!Utils.isSettingsConfigured(settings)) { if (showErrorOnEmptySettings) { - vscode.window.showErrorMessage( + await vscode.window.showErrorMessage( `Failed to scan file: Credential Digger extension is not configured`, ); } @@ -111,7 +111,7 @@ export async function scan( LoggerFactory.getInstance().error( `${id}: Error occurred when scanning ${currentDoc.uri.fsPath}: ${err}`, ); - vscode.window.showErrorMessage( + await vscode.window.showErrorMessage( `Failed to scan ${currentDoc.uri.fsPath} (${id})`, ); } @@ -124,7 +124,7 @@ export async function addRules(): Promise { .getConfiguration() .get('credentialDigger'); if (!Utils.isSettingsConfigured(settings)) { - vscode.window.showErrorMessage( + await vscode.window.showErrorMessage( 'Failed to add rules: Credential Digger extension is not configured', ); return; @@ -141,7 +141,7 @@ export async function addRules(): Promise { LoggerFactory.getInstance().error( `${id}: Error occurred when adding rules: ${err}`, ); - vscode.window.showErrorMessage(`Failed to add rules (${id})`); + await vscode.window.showErrorMessage(`Failed to add rules (${id})`); } } @@ -155,6 +155,6 @@ export async function scanSelectedFile( if (currentFile?.uri) { await callback(currentFile, true); } else { - vscode.window.showErrorMessage('Please select a file to scan'); + await vscode.window.showErrorMessage('Please select a file to scan'); } } diff --git a/src/lib/runner-factory.ts b/src/lib/runner-factory.ts index 2c89f51..55eb086 100644 --- a/src/lib/runner-factory.ts +++ b/src/lib/runner-factory.ts @@ -118,11 +118,11 @@ export default class RunnerFactory { // Add rules const success = await this.runner.addRules(); if (success) { - vscode.window.showInformationMessage( + await vscode.window.showInformationMessage( `Scanning rules added successfully to the database (${this.getId()})`, ); } else { - vscode.window.showErrorMessage( + await vscode.window.showErrorMessage( `Failed to add the scanning rules to the database (${this.getId()})`, ); }