@@ -28,12 +28,6 @@ Solution UpdateOptions(Solution oldSolution)
2828 var oldFallbackOptions = oldSolution . FallbackAnalyzerOptions ;
2929 oldFallbackOptions . TryGetValue ( LanguageNames . CSharp , out var csharpFallbackOptions ) ;
3030
31- var changedOptions = DetermineChangedOptions ( csharpFallbackOptions , editorConfigOptions ) ;
32- if ( changedOptions . IsEmpty )
33- {
34- return oldSolution ;
35- }
36-
3731 var builder = ImmutableDictionary . CreateBuilder < string , string > ( AnalyzerConfigOptions . KeyComparer ) ;
3832 if ( csharpFallbackOptions is not null )
3933 {
@@ -47,11 +41,16 @@ Solution UpdateOptions(Solution oldSolution)
4741 }
4842 }
4943
50- // update changed values:
51- foreach ( var ( key , value ) in changedOptions )
52- {
53- builder [ key ] = value ;
54- }
44+ // add o# option values:
45+ var lineFormattingOptions = editorConfigOptions . LineFormattingOptions ;
46+ AddOption ( FormattingOptions2 . UseTabs , lineFormattingOptions . UseTabs , builder ) ;
47+ AddOption ( FormattingOptions2 . TabSize , lineFormattingOptions . TabSize , builder ) ;
48+ AddOption ( FormattingOptions2 . IndentationSize , lineFormattingOptions . IndentationSize , builder ) ;
49+ AddOption ( FormattingOptions2 . NewLine , lineFormattingOptions . NewLine , builder ) ;
50+
51+ var implementTypeOptions = editorConfigOptions . ImplementTypeOptions ;
52+ AddOption ( ImplementTypeOptionsStorage . InsertionBehavior , ( ImplementTypeInsertionBehavior ) implementTypeOptions . InsertionBehavior , builder ) ;
53+ AddOption ( ImplementTypeOptionsStorage . PropertyGenerationBehavior , ( ImplementTypePropertyGenerationBehavior ) implementTypeOptions . PropertyGenerationBehavior , builder ) ;
5554
5655 var newFallbackOptions = oldFallbackOptions . SetItem (
5756 LanguageNames . CSharp ,
@@ -64,40 +63,14 @@ Solution UpdateOptions(Solution oldSolution)
6463 {
6564 throw ExceptionUtilities . Unreachable ( ) ;
6665 }
67- }
68-
69- private static ImmutableDictionary < string , string > DetermineChangedOptions (
70- StructuredAnalyzerConfigOptions ? csharpFallbackOptions ,
71- OmniSharpEditorConfigOptions editorConfigOptions )
72- {
73- var builder = ImmutableDictionary . CreateBuilder < string , string > ( ) ;
74-
75- AddOptionIfChanged ( FormattingOptions2 . UseTabs , csharpFallbackOptions , editorConfigOptions . LineFormattingOptions . UseTabs , builder ) ;
76- AddOptionIfChanged ( FormattingOptions2 . UseTabs , csharpFallbackOptions , editorConfigOptions . LineFormattingOptions . UseTabs , builder ) ;
77- AddOptionIfChanged ( FormattingOptions2 . TabSize , csharpFallbackOptions , editorConfigOptions . LineFormattingOptions . TabSize , builder ) ;
78- AddOptionIfChanged ( FormattingOptions2 . IndentationSize , csharpFallbackOptions , editorConfigOptions . LineFormattingOptions . IndentationSize , builder ) ;
79- AddOptionIfChanged ( FormattingOptions2 . NewLine , csharpFallbackOptions , editorConfigOptions . LineFormattingOptions . NewLine , builder ) ;
80-
81- AddOptionIfChanged ( ImplementTypeOptionsStorage . InsertionBehavior , csharpFallbackOptions , ( ImplementTypeInsertionBehavior ) editorConfigOptions . ImplementTypeOptions . InsertionBehavior , builder ) ;
82- AddOptionIfChanged ( ImplementTypeOptionsStorage . PropertyGenerationBehavior , csharpFallbackOptions , ( ImplementTypePropertyGenerationBehavior ) editorConfigOptions . ImplementTypeOptions . PropertyGenerationBehavior , builder ) ;
83-
84- return builder . ToImmutable ( ) ;
8566
86- static void AddOptionIfChanged < T > (
67+ static void AddOption < T > (
8768 PerLanguageOption2 < T > option ,
88- StructuredAnalyzerConfigOptions ? analyzerConfigOptions ,
8969 T value ,
9070 ImmutableDictionary < string , string > . Builder builder )
9171 {
9272 var configName = option . Definition . ConfigName ;
9373 var configValue = option . Definition . Serializer . Serialize ( value ) ;
94-
95- if ( analyzerConfigOptions ? . TryGetValue ( configName , out var existingValue ) == true &&
96- existingValue == configValue )
97- {
98- return ;
99- }
100-
10174 builder . Add ( configName , configValue ) ;
10275 }
10376 }
0 commit comments