-
Notifications
You must be signed in to change notification settings - Fork 229
Remove ImportDocumentSnapshot and (finally) fix nullability annotations on IDocumentSnapshot #11184
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
Remove ImportDocumentSnapshot and (finally) fix nullability annotations on IDocumentSnapshot #11184
Conversation
The comment explaining why this DocumentState method is internal seems to be out of date. It's currently only used within DocumentState, so this change removes the comment and makes it private.
When computing the ImportItems for a given document, we shouldn't need to compute an intermediary array of document snapshots.
This change removes several parameters from DocumentState.GenerateCodeDocumentAsync(...) and computes them internally. So, there's no longer a need to expose GetImportsAsync for GenerateCodeDocumetnAsync callers.
For a long while IDocumentSnapshot's FileKind, FilePath, and TargetPath properties have all been annotated as nullable. It turns out that the only reason for this was ImportDocumentSnapshot, which has been removed. So, we can now allow these properties to be correctly annotated as non-nullable,
davidwengier
left a comment
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.
Thank you for making FilePath and friends non nullable! Worth its weight in gold
| IDocumentSnapshot document, | ||
| RazorProjectItem? projectItem, | ||
| CancellationToken cancellationToken) | ||
| private static async Task<RazorSourceDocument> GetSourceAsync(IDocumentSnapshot document, RazorProjectEngine projectEngine, CancellationToken cancellationToken) |
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.
Might not be worth it, but if this method took string filePath, string fileKind, SourceText text, then it could be called from inside the loop in GetImportSources too (and become sync.
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'll definitely take a look at that in my next PR in this space.
Commit-by-commit is the way. 😄