@@ -32,6 +32,10 @@ internal class SA1027TabsMustNotBeUsed : DiagnosticAnalyzer
3232 /// </summary>
3333 public const string DiagnosticId = "SA1027" ;
3434
35+ internal static readonly string BehaviorKey = "Behavior" ;
36+ internal static readonly string ConvertToTabsBehavior = "ConvertToTabs" ;
37+ internal static readonly string ConvertToSpacesBehavior = "ConvertToSpaces" ;
38+
3539 private static readonly LocalizableString Title = new LocalizableResourceString ( nameof ( SpacingResources . SA1027Title ) , SpacingResources . ResourceManager , typeof ( SpacingResources ) ) ;
3640 private static readonly LocalizableString MessageFormat = new LocalizableResourceString ( nameof ( SpacingResources . SA1027MessageFormat ) , SpacingResources . ResourceManager , typeof ( SpacingResources ) ) ;
3741 private static readonly LocalizableString Description = new LocalizableResourceString ( nameof ( SpacingResources . SA1027Description ) , SpacingResources . ResourceManager , typeof ( SpacingResources ) ) ;
@@ -43,6 +47,12 @@ internal class SA1027TabsMustNotBeUsed : DiagnosticAnalyzer
4347 private static readonly Action < CompilationStartAnalysisContext > CompilationStartAction = HandleCompilationStart ;
4448 private static readonly Action < SyntaxTreeAnalysisContext , StyleCopSettings > SyntaxTreeAction = HandleSyntaxTree ;
4549
50+ private static readonly ImmutableDictionary < string , string > ConvertToTabsProperties =
51+ ImmutableDictionary . Create < string , string > ( ) . SetItem ( BehaviorKey , ConvertToTabsBehavior ) ;
52+
53+ private static readonly ImmutableDictionary < string , string > ConvertToSpacesProperties =
54+ ImmutableDictionary . Create < string , string > ( ) . SetItem ( BehaviorKey , ConvertToSpacesBehavior ) ;
55+
4656 /// <inheritdoc/>
4757 public override ImmutableArray < DiagnosticDescriptor > SupportedDiagnostics { get ; } =
4858 ImmutableArray . Create ( Descriptor ) ;
@@ -101,7 +111,8 @@ private static void HandleSyntaxTree(SyntaxTreeAnalysisContext context, StyleCop
101111 context . ReportDiagnostic (
102112 Diagnostic . Create (
103113 Descriptor ,
104- Location . Create ( syntaxTree , TextSpan . FromBounds ( violationStart , violationEnd ) ) ) ) ;
114+ Location . Create ( syntaxTree , TextSpan . FromBounds ( violationStart , violationEnd ) ) ,
115+ ConvertToTabsProperties ) ) ;
105116 }
106117
107118 if ( included . End > excluded . End )
@@ -130,7 +141,8 @@ private static void HandleSyntaxTree(SyntaxTreeAnalysisContext context, StyleCop
130141 context . ReportDiagnostic (
131142 Diagnostic . Create (
132143 Descriptor ,
133- Location . Create ( syntaxTree , TextSpan . FromBounds ( violationStart , violationEnd ) ) ) ) ;
144+ Location . Create ( syntaxTree , TextSpan . FromBounds ( violationStart , violationEnd ) ) ,
145+ ConvertToSpacesProperties ) ) ;
134146 }
135147
136148 if ( included . End > excluded . End )
@@ -148,15 +160,17 @@ private static void HandleSyntaxTree(SyntaxTreeAnalysisContext context, StyleCop
148160 context . ReportDiagnostic (
149161 Diagnostic . Create (
150162 Descriptor ,
151- Location . Create ( syntaxTree , convertToTabsSpans [ toTabsIndex ] ) ) ) ;
163+ Location . Create ( syntaxTree , convertToTabsSpans [ toTabsIndex ] ) ,
164+ ConvertToTabsProperties ) ) ;
152165 }
153166
154167 for ( ; toSpacesIndex < convertToSpacesSpans . Length ; toSpacesIndex ++ )
155168 {
156169 context . ReportDiagnostic (
157170 Diagnostic . Create (
158171 Descriptor ,
159- Location . Create ( syntaxTree , convertToSpacesSpans [ toSpacesIndex ] ) ) ) ;
172+ Location . Create ( syntaxTree , convertToSpacesSpans [ toSpacesIndex ] ) ,
173+ ConvertToSpacesProperties ) ) ;
160174 }
161175 }
162176
0 commit comments