Skip to content

Commit

Permalink
Add options
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Oct 1, 2024
1 parent d28da32 commit d6af30f
Show file tree
Hide file tree
Showing 25 changed files with 190 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(thi
SourceGeneratorExecution:
globalOptions.GetOption(SourceGeneratorExecution) ??
(globalOptions.GetOption(SourceGeneratorExecutionBalancedFeatureFlag) ? SourceGeneratorExecutionPreference.Balanced : SourceGeneratorExecutionPreference.Automatic),
ReloadChangedAnalyzerReferences:
globalOptions.GetOption(ReloadChangedAnalyzerReferences) ?? globalOptions.GetOption(ReloadChangedAnalyzerReferencesFeatureFlag),
ValidateCompilationTrackerStates: globalOptions.GetOption(ValidateCompilationTrackerStates));

public static readonly Option2<bool> ValidateCompilationTrackerStates = new(
Expand All @@ -28,4 +30,12 @@ public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(thi

public static readonly Option2<bool> SourceGeneratorExecutionBalancedFeatureFlag = new(
"dotnet_source_generator_execution_balanced_feature_flag", true);

public static readonly Option2<bool?> ReloadChangedAnalyzerReferences = new(
"dotnet_reload_changed_analyzer_references",
defaultValue: null,
isEditorConfigOption: true);

public static readonly Option2<bool> ReloadChangedAnalyzerReferencesFeatureFlag = new(
"dotnet_reload_changed_analyzer_references_feature_flag", true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@
</StackPanel>

<CheckBox x:Name="Run_code_analysis_in_separate_process"
Content="{x:Static local:AdvancedOptionPageStrings.Option_run_code_analysis_in_separate_process}" />
Content="{x:Static local:AdvancedOptionPageStrings.Option_run_code_analysis_in_separate_process}"
Checked="RunCodeAnalysisInSeparateProcess_Checked"
Unchecked="RunCodeAnalysisInSeparateProcess_Unchecked" />

<StackPanel Margin="15, 0, 0, 0">
<CheckBox x:Name="Automatically_reload_updated_analyzers_and_generators"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Automatically_reload_updated_analyzers_and_generators}" />
</StackPanel>

<CheckBox x:Name="Show_Remove_Unused_References_command_in_Solution_Explorer_experimental"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Show_Remove_Unused_References_command_in_Solution_Explorer_experimental}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon
BindToOption(on_the_right_edge_of_the_editor_window, InlineDiagnosticsOptionsStorage.Location, InlineDiagnosticsLocations.PlacedAtEndOfEditor, LanguageNames.CSharp);

BindToOption(Run_code_analysis_in_separate_process, RemoteHostOptionsStorage.OOP64Bit);
BindToOption(Automatically_reload_updated_analyzers_and_generators, WorkspaceConfigurationOptionsStorage.ReloadChangedAnalyzerReferences, () =>
{
// If the option has not been set by the user, check if the option is enabled from experimentation. If
// so, default to that.
return optionStore.GetOption(WorkspaceConfigurationOptionsStorage.ReloadChangedAnalyzerReferencesFeatureFlag);
});

BindToOption(Enable_file_logging_for_diagnostics, VisualStudioLoggingOptionsStorage.EnableFileLoggingForDiagnostics);
BindToOption(Skip_analyzers_for_implicitly_triggered_builds, FeatureOnOffOptions.SkipAnalyzersForImplicitlyTriggeredBuilds);
Expand Down Expand Up @@ -272,6 +278,16 @@ private void DisplayInlineTypeHints_Unchecked(object sender, RoutedEventArgs e)
UpdateInlineHintsOptions();
}

private void RunCodeAnalysisInSeparateProcess_Checked(object sender, RoutedEventArgs e)
{
Automatically_reload_updated_analyzers_and_generators.IsEnabled = true;
}

private void RunCodeAnalysisInSeparateProcess_Unchecked(object sender, RoutedEventArgs e)
{
Automatically_reload_updated_analyzers_and_generators.IsEnabled = false;
}

private void EnterOutliningMode_Checked(object sender, RoutedEventArgs e)
{
Collapse_regions_on_file_open.IsEnabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,8 @@ public static string Option_Automatic_Run_generators_after_any_change

public static string Option_Balanced_Run_generators_after_saving_or_building
=> ServicesVSResources.Balanced_Run_generators_after_saving_or_building;

public static string Option_Automatically_reload_updated_analyzers_and_generators
=> ServicesVSResources.Automatically_reload_updated_analyzers_and_generators;
}
}
57 changes: 30 additions & 27 deletions src/VisualStudio/Core/Def/ServicesVSResources.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -1940,4 +1940,7 @@ Additional information: {1}</value>
<data name="Show_hints_for_collection_expressions" xml:space="preserve">
<value>Show hints for collection expressions</value>
</data>
<data name="Automatically_reload_updated_analyzers_and_generators" xml:space="preserve">
<value>Automatically reload updated analyzers and generators (requires restart)</value>
</data>
</root>
5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d6af30f

Please sign in to comment.