-
Notifications
You must be signed in to change notification settings - Fork 196
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
Update ProjectWorkspaceState and HostProject at the same time #11191
Update ProjectWorkspaceState and HostProject at the same time #11191
Conversation
(and clean up a teeny tiny bit)
Do not be put off by the integration test failures, the tests that failed are currently having a little flakiness moment. |
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'm unsure about the two failing integration tests though.
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectDifference.cs
Outdated
Show resolved
Hide resolved
else if (currentConfiguration.Equals(configuration) && | ||
currentRootNamespace == rootNamespace) |
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.
Isn't RazorConfiguration
is a record? If so, it should be equivalent to use ==
.
else if (currentConfiguration.Equals(configuration) && | |
currentRootNamespace == rootNamespace) | |
else if (currentConfiguration == configuration && | |
currentRootNamespace == rootNamespace) |
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.
Yes, you're right. Paranoia because ProjectWorkspaceState
isn't a record, yet we had code that did ==
and .Equals
and I deleted one of the checks, but it was the wrong one. Looking forward to fixing ProjectWorkspaceState in future.
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've got a few branches with ProjectWorkspaceState
converted to a record that I'm hoping to resurrect.
Follow up to #11191 which caused RPS regressions. There were some edge-y things I papered over in that PR, assuming they were unnecessary over-complications, but given the RPS regression I had a closer look, and they could have caused re-compilation of closed documents when only tag helpers changed, which would be new behaviour. Not _entirely_ convinced the re-compilation is all unnecessary (if a document used a Tag Helper that has only just been discovered, then its code gen would legitimately change) but it's hard to justify when I can't point to any tooling for the closed files that would actually benefit from the extra work. The key thing is not changing `DocumentCollectionVersion` when only `ProjectWorkspaceState` changes. Not re-calculating import documents was just a little extra amuse-bouche, and not caching the computed state tracker is pure paranoia.
Preparation for ongoing work to hook up the Roslyn tokenizer and #11182 I suppose.
There were three places that
UpdateProjectWorkspaceState
was called:RazorProjectService
, just before callingUpdateProjectConfiguration
ProjectWorkspaceStateGenerator
, where we will need to add a call toUpdateProjectConfiguration
in future, to wire up the tokenizerPrevious attempts to plumb through more things for
RazorConfiguration
resulted in RPS failures, that appeared to be simply more compilations of closed files. This makes sense because we were adding another update, which would have triggered another set ofProjectChanged
events. I thought it would make more sense to combine these two updates together, so no matter which part of the project was being updated, there could be a singleProjectChanged
notification. This is that.