-
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
Rerun generators when an additional file is saved. #74542
Conversation
[Name(PredefinedCommandHandlerNames.SourceGeneratorSave)] | ||
[ContentType(StandardContentTypeNames.Text)] |
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.
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.
bleagh.
@jasonmalinowski @sharwell any ideas on this?
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.
@olegtk for thoughts as well. We only want to listen to saves when roslyn is actually loaded. but we do need to know about saves to files that aren't roslyn content type (like saving an xml file inside a roslyn project that will then have an impact on generators).
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.
Is RDT or another vs api a possibility here?
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.
Yeah listening to the RDT or some other VS would probably be what we need to do here.
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.
@jasonmalinowski anything i can look into?
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 maybe https://github.com/dotnet/roslyn/blob/main/src/VisualStudio/Core/Def/ProjectSystem/OpenTextBufferProvider.cs#L32
Looks like there is an OnAfterSave method we could implement
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.
Definitely needs an RPS validation to make sure its not loading roslyn everywhere now.
[Name(PredefinedCommandHandlerNames.SourceGeneratorSave)] | ||
[ContentType(StandardContentTypeNames.Text)] |
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.
This feels like its going to cause a lot of RPS regressions as this will now run on any content type. Can you do an RPS validation to check?
Thanks all. switched to RDT. |
{ | ||
public string DisplayName => ServicesVSResources.Roslyn_save_command_handler; |
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.
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.
will do in followup.
[Export(typeof(ICommandHandler))] | ||
[ContentType(ContentTypeNames.RoslynContentType)] | ||
[ContentType(ContentTypeNames.XamlContentType)] | ||
[Name(PredefinedCommandHandlerNames.SourceGeneratorSave)] |
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.
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.
will do in followup.
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.
no longer using the Text content type.
Fixes #74395