Skip to content
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

Merged
merged 9 commits into from
Jul 25, 2024

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #74395

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner July 24, 2024 21:13
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 24, 2024
[Name(PredefinedCommandHandlerNames.SourceGeneratorSave)]
[ContentType(StandardContentTypeNames.Text)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ContentType(StandardContentTypeNames.Text)]

I don't have any suggestions here, but won't this cause roslyn to load when opening txt files?

Copy link
Member Author

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?

Copy link
Member Author

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).

Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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

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?

@CyrusNajmabadi CyrusNajmabadi requested a review from dibarbet July 25, 2024 01:17
@CyrusNajmabadi
Copy link
Member Author

Thanks all. switched to RDT.

{
public string DisplayName => ServicesVSResources.Roslyn_save_command_handler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServicesVSResources.Roslyn_save_command_handler

delete?

Copy link
Member Author

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)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceGeneratorSave

delete?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do in followup.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CyrusNajmabadi CyrusNajmabadi dismissed dibarbet’s stale review July 25, 2024 14:29

no longer using the Text content type.

@CyrusNajmabadi CyrusNajmabadi merged commit b16b89d into dotnet:main Jul 25, 2024
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the saveFix branch July 25, 2024 14:29
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 25, 2024
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saving an AdditionalFiles document in Balanced mode fails to trigger source generator
5 participants