-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support multiselection in 'Add Folder to Workspace...' dialog #9684
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I can confirm that the changes allow to select multiple folders in the browser and Electron (Ubuntu) environment.
48efa1b
to
80f6db0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the behavior works as intended:
- verified without a
*.theia-workspace
file present and adding multiple roots - verified with a previous
*.theia-workspace
file present and adding multiple roots - adding a single workspace root works as before
Signed-off-by: Colin Grant <colin.grant@ericsson.com>
80f6db0
to
abc51a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes work for me 👍
async addRoot(uris: URI[] | URI): Promise<void> { | ||
const toAdd = Array.isArray(uris) ? uris : [uris]; | ||
await this.spliceRoots(this._roots.length, 0, ...toAdd); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it can be simplified to:
async addRoot(...uris: URI[]): Promise<void> {
await this.spliceRoots(this._roots.length, 0, ...uris);
}
Calls like the following are allowed:
await this.workspaceService.addRoot(...workspaceFolders);
await this.workspaceService.addRoot(uri);
But I won't nitpick :)
Signed-off-by: Colin Grant colin.grant@ericsson.com
What it does
Fixes #9665 by allowing multiple selection in the workspace dialog and ensuring that the public methods 'addRoot' and 'removeRoots' (and new method
addRoots
) don't return before the._roots
field of theWorkspaceService
has been updated. Previously, changes to the workspace would emit an event that would trigger anupdateWorkspace
cycle, but since that method is also asynchronous, it was guaranteed not to have finished its work in the tick afteraddRoot
andremoveRoots
resolved, meaning that evenawait
ing those methods didn't guarantee that theWorkspaceService
was ready for another call.How to test
...
context menu in the explorer).Review checklist
Reminder for reviewers