Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version supporting multiple workspace roots #48

Merged
merged 20 commits into from
Oct 3, 2024

Conversation

jvdprng
Copy link
Member

@jvdprng jvdprng commented Sep 10, 2024

This PR adds support for multiple workspace roots. It is currently in draft for testing purposes.

@jvdprng jvdprng marked this pull request as ready for review September 20, 2024 10:42
package.json Outdated
Comment on lines 344 to 352
"command": "weAudit.setupRepositoriesCurrent",
"when": "view == gitConfig",
"group": "navigation@2"
},
{
"command": "weAudit.setupRepositoriesAll",
"when": "view == gitConfig",
"group": "navigation@3"
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to only show the setupRepositoriesAll button when there are multiple repos

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 88aff0e

Comment on lines 276 to 278
// if (!this.rootPath) { // TODO: Should not happen?
// return;
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or uncomment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

* Toggle a file as audited.
* @param uri the `uri` of the target file.
* @param relativePath the relative path of the target file to this workspace root.
* @returns A list of `uri`s to decorate and the relevant username. TODO
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7


return [urisToDecorate, relevantUsername];
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the following functions are missing return types on their signatures

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

Comment on lines 517 to 521
* @returns `true` if the file is in the AuditedFiles, `false` if not.
*/
isAudited(path: string) {
return this.auditedFiles.find((entry) => entry.path === path);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does not return true or false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

const disposable = vscode.workspace.onDidChangeWorkspaceFolders(listener);
context.subscriptions.push(disposable);

this.activeConfigs = [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.activeConfigs is already set on line 31

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

Comment on lines 79 to 81
// if (parsedPath.name === this.username && this.activeConfigs.length === 0) {
// this.activeConfigs.push(entry);
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be uncommented

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

Comment on lines +2 to +4
<div class="detailsDiv">
<vscode-dropdown position="below" id="workspace-root-list-dropdown"> </vscode-dropdown>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could hide this if there is only one workspace. We can leave it as future enhancement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left it for now

Comment on lines 133 to 144
// TODO error
return;
}
vscode.commands.executeCommand("weAudit.updateGitConfig", rootPath, message.clientURL, message.auditURL, message.commitHash);
return;
case "choose-workspace-root":
rootPath = this.dirToPathMap.get(message.rootDir);
if (rootPath === undefined) {
// TODO error
return;
}
//this.currentRootPath = message.rootPath;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of todos and commented code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

rootList.textContent = "";
for (let i = 0; i < message.rootDirs.length; i++) {
const option = document.createElement("vscode-option");
//option.value = message.rootDirs[i];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove it if we don't need it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved in 9ae4bf7

@fcasal
Copy link
Collaborator

fcasal commented Sep 23, 2024

There is a bug that causes issues to disappear from one workspace. To reproduce:

  • have one 2-region finding in workspace A, one regular finding in workspace B
  • hide the workspace B findings
  • drag and drop one of the 2 regions out to create 2 findings
  • unhide workspace B -> the workspace B finding will disappear

@fcasal
Copy link
Collaborator

fcasal commented Sep 23, 2024

  • have two workspaces without findings
  • create finding on workspace A
  • press the "Update files" on the WEAUDIT FILES tab
  • unexpected behavior: the user.weaudit file will appear on both workspaces when it should probably appear on workspace A
  • bug: the Eye icon is disabled, but the finding is being displayed

@@ -11,7 +11,7 @@ let darkEyePath: vscode.Uri;
export class MultipleSavedFindingsTree implements vscode.TreeDataProvider<ConfigTreeEntry> {
private configurationEntries: ConfigurationEntry[];
private rootEntries: WorkspaceRootEntry[];
private rootPaths: string[];
private rootPathsAndLabels: [string, string][];
private activeConfigs: ConfigurationEntry[];
private username: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

username is not used here anymore

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find an eslint config that warns about this

@@ -14,57 +13,60 @@ export function activateGitConfigWebview(context: vscode.ExtensionContext) {
class GitConfigProvider implements vscode.WebviewViewProvider {
public static readonly viewType = "gitConfig";
private _disposables: vscode.Disposable[] = [];
private currentRootPath: string;
private currentRootPathAndLabel: [string, string];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rewrite this with an interface so that we don't have to do [0] and [1] through the code?

@@ -1217,8 +1523,7 @@ export class CodeMarker implements vscode.TreeDataProvider<TreeEntry> {

private workspaces: MultiRootManager;
private username: string;
//private currentlySelectedUsernames: string[];
private currentlySelectedConfigs: ConfigurationEntry[];
//private currentlySelectedConfigs: ConfigurationEntry[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

vscode.commands.registerCommand("weAudit.manageConfiguration", (config: ConfigurationEntry, select: boolean) => {
return this.manageConfiguration(config, select);
});
// // Returns whether a configuration is currently selected and optionally selects it if not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

}
return true;
}
// /**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

@jvdprng jvdprng merged commit 48bb0f8 into main Oct 3, 2024
4 checks passed
@jvdprng jvdprng deleted the jp/multiple-workspaces branch October 3, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants