-
Notifications
You must be signed in to change notification settings - Fork 676
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
Display prompt to restore all projects #2323
Conversation
I am not sure what should be the names of the commands in the command pallette. |
Codecov Report
@@ Coverage Diff @@
## master #2323 +/- ##
==========================================
+ Coverage 62.21% 62.25% +0.04%
==========================================
Files 86 86
Lines 3864 3855 -9
Branches 556 551 -5
==========================================
- Hits 2404 2400 -4
+ Misses 1299 1293 -6
- Partials 161 162 +1
Continue to review full report at Codecov.
|
package.json
Outdated
"category": ".NET" | ||
}, | ||
{ | ||
"command": "dotnet.restore.all", | ||
"title": "Restore Packages", |
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.
Should we rename this to "Restore All Projects" for symmetry with "Restore Project"?
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.
Done.
let csharpConfig = this.vscode.workspace.getConfiguration('csharp'); | ||
if (!csharpConfig.get<boolean>('suppressDotnetRestoreNotification')) { | ||
let message = `There are unresolved dependencies from '${this.vscode.workspace.asRelativePath(event.unresolvedDependencies.FileName)}'. Please execute the restore command to continue.`; | ||
return showInformationMessage(this.vscode, message, { title: 'Restore', command: 'dotnet.restore', args: event.unresolvedDependencies.FileName }); | ||
let message = `There are unresolved dependencies'. Please execute the restore command to continue.`; |
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.
@DustinCampbell Do we want to display the solution name ( the one we display in the status bar item) here -- There are unresolved dependencies from abc.sln
?
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.
Maybe. If we do, the text should probably be in abc.sln
rather than from abc.sln
.
However, I'm interested in the semantics of how this message appears. If several "unresolved dependencies" events trigger for different projects, will we just display a single message? If so, would it be better if we triggered dotnet restore
for each project rather than running it over the whole workspace? Doing the latter might be unexpected.
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 think one problem is that discovery of unrestored projects is asynchronous. If we implement the feature so that it only restores projects for which it received the "unrestored project" message, there's a race condition between this popup and the discovery. Eg, one unrestored project is discovered and the warning is shown, and the user clicks restore. O# continues discovering projects and finds more, triggering a new prompt that the user needs to click to restore the newly discovered projects.
Restoring the entire sln file at once avoids that race condition. I suppose restoring the whole solution could be slow, but what else is "unexpected" about it?
There's also the case of multiple csproj's floating around with no sln file. I'm not sure how you would coordinate restoring all of those projects simulatenously without an sln...
81aa30b
to
dc55246
Compare
src/features/commands.ts
Outdated
dotnetRestoreAllProjects(server, eventStream); | ||
} | ||
}); | ||
let d4 = vscode.commands.registerCommand('dotnet.restore.project', () => pickProjectAndDotnetRestore(server, eventStream)); |
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.
This is getting a bit silly. Can we just start pushing these into an array and construct our composite disposable from that?
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.
Done
let descriptors = await getProjectDescriptors(server); | ||
eventStream.post(new CommandDotNetRestoreStart()); | ||
for (let descriptor of descriptors) { | ||
await dotnetRestore(descriptor.Directory, eventStream); |
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.
What does the log output look like while we restore multiple projects?
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.
0e7c9dd
to
ddb85ec
Compare
@DustinCampbell @akshita31 Do we still have outstanding concerns about this PR or is it ready to merge? 😄 |
None from me. |
Fixes: #2276 #240
The prompt that asks to restore the project dependencies appears just once and clicking on "Restore" , restores all the projects.
The command palette has 2 options: