Skip to content

Commit

Permalink
fix(extension): wait for the execution of show message
Browse files Browse the repository at this point in the history
  • Loading branch information
sgarouachi committed Aug 24, 2023
1 parent 2995bcd commit 0a6e508
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function activate(
): Promise<void> {
// Create storageUri
if (!context.storageUri) {
vscode.window.showErrorMessage(
await vscode.window.showErrorMessage(
`Failed to activate ${MetaReaderFactory.getInstance().getExtensionName()}`,
);
return;
Expand All @@ -26,7 +26,7 @@ export async function activate(
);

// Show info message
vscode.window.showInformationMessage(
await vscode.window.showInformationMessage(
`${MetaReaderFactory.getInstance().getExtensionName()} is now active!`,
);

Expand Down Expand Up @@ -85,7 +85,7 @@ export async function scan(
.get<ExtensionConfig>('credentialDigger');
if (!Utils.isSettingsConfigured(settings)) {
if (showErrorOnEmptySettings) {
vscode.window.showErrorMessage(
await vscode.window.showErrorMessage(
`Failed to scan file: Credential Digger extension is not configured`,
);
}
Expand All @@ -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})`,
);
}
Expand All @@ -124,7 +124,7 @@ export async function addRules(): Promise<void> {
.getConfiguration()
.get<ExtensionConfig>('credentialDigger');
if (!Utils.isSettingsConfigured(settings)) {
vscode.window.showErrorMessage(
await vscode.window.showErrorMessage(
'Failed to add rules: Credential Digger extension is not configured',
);
return;
Expand All @@ -141,7 +141,7 @@ export async function addRules(): Promise<void> {
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})`);
}
}

Expand All @@ -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');
}
}
4 changes: 2 additions & 2 deletions src/lib/runner-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()})`,
);
}
Expand Down

0 comments on commit 0a6e508

Please sign in to comment.