-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Provide option to only update source-generators on special events (like a build) #72494
Conversation
@@ -40,4 +37,7 @@ public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(thi | |||
|
|||
public static readonly Option2<bool> EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag = new( | |||
"dotnet_enable_opening_source_generated_files_in_workspace_feature_flag", WorkspaceConfigurationOptions.Default.EnableOpeningSourceGeneratedFiles); | |||
|
|||
public static readonly Option2<bool> RunSourceGeneratorsExplicitly = new( | |||
"dotnet_run_source_generators_explicitly", WorkspaceConfigurationOptions.Default.RunSourceGeneratorsExplicitly); |
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.
@tmat do i need to do anything to ensure that this works if the user sets this in their editorconfig?
@@ -61,9 +61,6 @@ | |||
Content="{x:Static local:AdvancedOptionPageStrings.Option_run_code_analysis_on_dotnet}" /> | |||
</StackPanel> | |||
|
|||
<CheckBox x:Name="Analyze_source_generated_files" | |||
Content="{x:Static local:AdvancedOptionPageStrings.Option_analyze_source_generated_files}" /> |
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.
moved down to a dedicated source-generator section.
|
||
var bindingExpression = radiobutton.SetBinding(RadioButton.IsCheckedProperty, binding); | ||
_bindingExpressions.Add(bindingExpression); | ||
} |
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.
same as the code below. just works for options that are not PerLanguage ones.
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 code was needed to support a non-per-language nullable enum option value.
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.cs
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_Checksum.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Workspace/Solution/SourceGeneratorExecutionVersion.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/CoreTest/SolutionTests/SolutionWithSourceGeneratorTests.cs
Outdated
Show resolved
Hide resolved
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 For review when you get back. |
Followup to #72490
This approach ensures that when SGs are very expensive (even incremental ones) that they can be set to run only when a build happens. That allows hte price to be paid at that point, with all further compilation requests using the results of that SG run up until the point of the next run.
This puts the user in control of that expense and provides a buffer against poorly run (or just very very expensive) generators. This is user configurable, allowing users to pick between this behavior, or the current behavior where generators just run automatically after any change.
Options looks like this:
There's also an option to force reloading of generators:
Tests incoming.