-
Notifications
You must be signed in to change notification settings - Fork 229
YAPCSSF: Automatically add projects if they don't exist when updating #10335
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
Conversation
…egular projects (or vice versa) while open
|
|
||
| if (newProject.TryGetDocument(documentFilePath, out var document)) | ||
| { | ||
| // We don't enqueue the current document because added documents are initially closed. |
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 change is because we have too many moving pieces at the moment. When I changed things so that newly added documents stopped guessing which was the right project to be added to, it meant we didn't start generating when a document moved from the misc files project to the right one. Since the EnqueueIfNecessary already had a check for only generating open documents, this explicit lack of work made no sense to me, and seems to me like it was only valid because the "guess which project to go in" was guessing correctly most of the time.
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.
"Why isn't it broken in main then?" I hear you ask. Good question! It works in main for precisely the inefficiency this PR (and all of the others 😁) is trying to solve! In main, rather than migrating one document, we fully reset the whole project, which means going to 0 tag helpers, then in a future update back to the real number of tag helpers. That change in tag helpers (among other changes) triggers a ProjectChanged change type, which is handled elsewhere in this switch, and triggers the generation of the document.
| _logger.LogInformation($"Failed to update untracked project '{projectKey}'."); | ||
| return; | ||
| } | ||
| updater => |
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.
nit: indentation
|
Fourth time's the charm! |
Fixes #10306
This change takes a different approach than #10308 and #10330 and #10332 because life was meant to be interesting.
The original problem we were trying to solve is that when a Reset then Add came in, we would migrate all of the documents out of the project, then migrate them all back in again. The various solutions in the other PRs you can read about at your leisure, this one takes a rather simple approach:
In the long run we should remove
IRazorProjectService.AddProjectAsyncentirely, and renameIRazorProjectService.UpdateProjectAsynctoResetProjectAsync, but doing that now would just conflict with other open PRs.