Skip to content

Commit

Permalink
fix(weaudi-files-view): refresh loaded files on initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
fcasal committed Mar 19, 2024
1 parent a421a92 commit 6cabc72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/codeMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ export class CodeMarker implements vscode.TreeDataProvider<TreeEntry> {
this.loadSavedDataFromFile(path.join(vscodeFolder, file), true, true, parsedPath.name);
}
});
vscode.commands.executeCommand("weAudit.findAndLoadConfigurationFiles");
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/multiConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let darkEyePath: vscode.Uri;
export class MultipleSavedFindingsTree implements vscode.TreeDataProvider<ConfigurationEntry> {
private configurationEntries: ConfigurationEntry[];
private workspacePath: string;
private currentUsernames: string[];
private activeUsernames: string[];
private username: string;

private _onDidChangeTreeDataEmitter = new vscode.EventEmitter<ConfigurationEntry | undefined | void>();
Expand All @@ -31,12 +31,12 @@ export class MultipleSavedFindingsTree implements vscode.TreeDataProvider<Config
this.configurationEntries = [];
this.findAndLoadConfigurationFiles();

this.currentUsernames = [];
this.activeUsernames = [];
this.username = userInfo().username;

// register a command that refreshes the tree
vscode.commands.registerCommand("weAudit.refreshSavedFindings", (usernames: string[]) => {
this.currentUsernames = usernames;
this.activeUsernames = usernames;
this.refresh();
});

Expand All @@ -59,8 +59,8 @@ export class MultipleSavedFindingsTree implements vscode.TreeDataProvider<Config
const parsedPath = path.parse(file);
const entry = { path: path.join(vscodeFolder, file), username: parsedPath.name };
this.configurationEntries.push(entry);
if (parsedPath.name === this.username && this.currentUsernames.length === 0) {
this.currentUsernames.push(this.username);
if (parsedPath.name === this.username && this.activeUsernames.length === 0) {
this.activeUsernames.push(this.username);
}
}
});
Expand Down Expand Up @@ -90,7 +90,7 @@ export class MultipleSavedFindingsTree implements vscode.TreeDataProvider<Config
treeItem.description = path.basename(element.path);
treeItem.tooltip = element.username + "'s findings";

if (this.currentUsernames.includes(element.username)) {
if (this.activeUsernames.includes(element.username)) {
treeItem.iconPath = { light: lightEyePath, dark: darkEyePath };
}

Expand Down

0 comments on commit 6cabc72

Please sign in to comment.