File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/Analyzers/CSharp/Analysis Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ private static void AnalyzeEnumDeclaration(SyntaxNodeAnalysisContext context)
104104
105105 int count = members . Count ;
106106 int separatorCount = members . SeparatorCount ;
107+ TextSpan bracesSpan = TextSpan . FromBounds ( enumDeclaration . OpenBraceToken . SpanStart , enumDeclaration . CloseBraceToken . Span . End ) ;
107108
108109 if ( count == separatorCount )
109110 {
@@ -112,7 +113,7 @@ private static void AnalyzeEnumDeclaration(SyntaxNodeAnalysisContext context)
112113 ReportRemove ( context , members . GetSeparator ( count - 1 ) ) ;
113114 }
114115 else if ( style == TrailingCommaStyle . OmitWhenSingleLine
115- && enumDeclaration . IsSingleLine ( cancellationToken : context . CancellationToken ) )
116+ && bracesSpan . IsSingleLine ( enumDeclaration . SyntaxTree , cancellationToken : context . CancellationToken ) )
116117 {
117118 ReportRemove ( context , members . GetSeparator ( count - 1 ) ) ;
118119 }
@@ -124,7 +125,7 @@ private static void AnalyzeEnumDeclaration(SyntaxNodeAnalysisContext context)
124125 ReportAdd ( context , members . Last ( ) ) ;
125126 }
126127 else if ( style == TrailingCommaStyle . OmitWhenSingleLine
127- && ! enumDeclaration . IsSingleLine ( cancellationToken : context . CancellationToken ) )
128+ && ! bracesSpan . IsSingleLine ( enumDeclaration . SyntaxTree , cancellationToken : context . CancellationToken ) )
128129 {
129130 ReportAdd ( context , members . Last ( ) ) ;
130131 }
You can’t perform that action at this time.
0 commit comments