Skip to content

Conversation

@DustinCampbell
Copy link
Member

Commit-by-commit is the way. 😄

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,
@DustinCampbell DustinCampbell requested a review from a team as a code owner November 8, 2024 01:03
Copy link
Member

@davidwengier davidwengier left a 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)
Copy link
Member

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.

Copy link
Member Author

@DustinCampbell DustinCampbell Nov 8, 2024

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.

@DustinCampbell DustinCampbell merged commit df548d6 into dotnet:main Nov 8, 2024
12 checks passed
@DustinCampbell DustinCampbell deleted the remove-importdocumentsnapshot branch November 8, 2024 20:39
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 8, 2024
@jjonescz jjonescz modified the milestones: Next, 17.13 P2 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants