Skip to content

Commit

Permalink
fixed policy violation not triggering when manifest file is already o…
Browse files Browse the repository at this point in the history
…pened
  • Loading branch information
rajpreet-s committed Sep 26, 2024
1 parent eb91bbd commit 6443e9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export async function activate(context: vscode.ExtensionContext) {

await debrickedCommand.commands(context);
await providers.registerHover(context);
await providers.registerDependencyPolicyProvider(context);

const debCommandsProvider = new DebrickedCommandsTreeDataProvider();
vscode.window.registerTreeDataProvider(Organization.debrickedCommand, debCommandsProvider);
Expand Down Expand Up @@ -64,6 +63,7 @@ export async function activate(context: vscode.ExtensionContext) {

// Add file watcher for all files found from 'debricked files find'
await watchers.registerWatcher(context);
await providers.registerDependencyPolicyProvider(context); // after adding watcher and scanning we should add the policy provider

progress.report({ message: "Debricked extension is ready to use", increment: 100 - progressCount });
await new Promise((resolve) => setTimeout(resolve, 1000)); // added for showing the last progress info
Expand Down
4 changes: 4 additions & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class Providers {
context.subscriptions.push(diagnosticCollection);

const provider = new DependencyPolicyProvider(diagnosticCollection);
//added to activate the policy violation provider when the manifest file is already open
if (vscode.window.activeTextEditor?.document) {
provider.checkPolicyViolation(vscode.window.activeTextEditor?.document);
}

context.subscriptions.push(
vscode.languages.registerCodeActionsProvider({ scheme: "file" }, provider, {
Expand Down
2 changes: 1 addition & 1 deletion src/services/scanService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ScanService {
}
}

vscode.window.withProgress(
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window,
title: Organization.nameCaps,
Expand Down

0 comments on commit 6443e9d

Please sign in to comment.