-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Allow cohosting to make changes to source generated documents #77331
Allow cohosting to make changes to source generated documents #77331
Conversation
@@ -81,6 +81,11 @@ private static CompletionListCache GetCache() | |||
return InlineCompletionsHandler.GetInlineCompletionItemsAsync(logger, document, position, options, xmlSnippetParser, cancellationToken); | |||
} | |||
|
|||
public static Document ApplyProvisionalEdit(SourceGeneratedDocument generatedDocument, SourceText updatedDocumentText) | |||
{ | |||
return generatedDocument.Project.Solution.WithFrozenSourceGeneratedDocument(generatedDocument.Identity, DateTime.Now, updatedDocumentText); |
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.
@CyrusNajmabadi Did we use UtcNow for these, generally?
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.
Happy to update this, but just a note that the resulting document and the solution that contains it are thrown away immediately after asking for completion items from it
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 like DateTime.Now?
https://github.com/dotnet/roslyn/blob/main/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker_Generators.cs#L294
I might have missed a spot though, was hard enough tracking down that one :)
Superseded by #77587 |
Needed to enable Razor completion to work with the source generator.
Part of dotnet/razor#10693