From abe1143278c9c08c8b78ba50915ea9a7b59c8aa0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 20 Dec 2024 09:13:09 -0800 Subject: [PATCH 1/2] Fixup OmniSharp fallback AnalyzerConfigOption updater --- ...arpSolutionAnalyzerConfigOptionsUpdater.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs b/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs index dce77ef66758..c3152b831b1c 100644 --- a/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs +++ b/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs @@ -40,14 +40,14 @@ internal static bool UpdateOptions(Workspace workspace, OmniSharpEditorConfigOpt // add o# option values: var lineFormattingOptions = editorConfigOptions.LineFormattingOptions; - AddOption(FormattingOptions2.UseTabs, lineFormattingOptions.UseTabs, builder); - AddOption(FormattingOptions2.TabSize, lineFormattingOptions.TabSize, builder); - AddOption(FormattingOptions2.IndentationSize, lineFormattingOptions.IndentationSize, builder); - AddOption(FormattingOptions2.NewLine, lineFormattingOptions.NewLine, builder); + AddOption(FormattingOptions2.UseTabs, lineFormattingOptions.UseTabs); + AddOption(FormattingOptions2.TabSize, lineFormattingOptions.TabSize); + AddOption(FormattingOptions2.IndentationSize, lineFormattingOptions.IndentationSize); + AddOption(FormattingOptions2.NewLine, lineFormattingOptions.NewLine); var implementTypeOptions = editorConfigOptions.ImplementTypeOptions; - AddOption(ImplementTypeOptionsStorage.InsertionBehavior, (ImplementTypeInsertionBehavior)implementTypeOptions.InsertionBehavior, builder); - AddOption(ImplementTypeOptionsStorage.PropertyGenerationBehavior, (ImplementTypePropertyGenerationBehavior)implementTypeOptions.PropertyGenerationBehavior, builder); + AddOption(ImplementTypeOptionsStorage.InsertionBehavior, (ImplementTypeInsertionBehavior)implementTypeOptions.InsertionBehavior); + AddOption(ImplementTypeOptionsStorage.PropertyGenerationBehavior, (ImplementTypePropertyGenerationBehavior)implementTypeOptions.PropertyGenerationBehavior); var newFallbackOptions = oldFallbackOptions.SetItem( LanguageNames.CSharp, @@ -61,14 +61,13 @@ internal static bool UpdateOptions(Workspace workspace, OmniSharpEditorConfigOpt throw ExceptionUtilities.Unreachable(); } - static void AddOption( + void AddOption( PerLanguageOption2 option, - T value, - ImmutableDictionary.Builder builder) + T value) { var configName = option.Definition.ConfigName; var configValue = option.Definition.Serializer.Serialize(value); - builder.Add(configName, configValue); + builder[configName] = configValue; } } } From e9cb10faa9a8c7be7e186a642ac3ed0eaeaab69d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 20 Dec 2024 09:33:04 -0800 Subject: [PATCH 2/2] fixup --- ...harpSolutionAnalyzerConfigOptionsUpdater.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs b/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs index c3152b831b1c..dd1209b916f3 100644 --- a/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs +++ b/src/Features/ExternalAccess/OmniSharp/Options/OmniSharpSolutionAnalyzerConfigOptionsUpdater.cs @@ -55,19 +55,19 @@ internal static bool UpdateOptions(Workspace workspace, OmniSharpEditorConfigOpt var newSolution = oldSolution.WithFallbackAnalyzerOptions(newFallbackOptions); return workspace.TryApplyChanges(newSolution); + + void AddOption( + PerLanguageOption2 option, + T value) + { + var configName = option.Definition.ConfigName; + var configValue = option.Definition.Serializer.Serialize(value); + builder[configName] = configValue; + } } catch (Exception e) when (FatalError.ReportAndPropagate(e, ErrorSeverity.Diagnostic)) { throw ExceptionUtilities.Unreachable(); } - - void AddOption( - PerLanguageOption2 option, - T value) - { - var configName = option.Definition.ConfigName; - var configValue = option.Definition.Serializer.Serialize(value); - builder[configName] = configValue; - } } }