This repository was archived by the owner on Jul 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
src/Microsoft.DotNet.CodeFormatting/Rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,31 +110,31 @@ private static string GetNewSymbolName(ISymbol symbol)
110110 private async Task < Solution > CleanSolutionAsync ( Solution solution , CancellationToken cancellationToken )
111111 {
112112 var documentIdsToProcess = solution . Projects . SelectMany ( p => p . DocumentIds ) . ToList ( ) ;
113-
113+ const string rename = "Rename" ;
114114 foreach ( var documentId in documentIdsToProcess )
115115 {
116116 var root = await solution . GetDocument ( documentId ) . GetSyntaxRootAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
117117
118118 while ( true )
119119 {
120- var renameNodes = root . DescendantNodes ( descendIntoTrivia : true ) . Where ( s => s . GetAnnotations ( "Rename" ) . Any ( ) ) ;
120+ var renameNodes = root . DescendantNodes ( descendIntoTrivia : true ) . Where ( s => s . GetAnnotations ( rename ) . Any ( ) ) ;
121121 if ( ! renameNodes . Any ( ) )
122122 {
123123 break ;
124124 }
125125
126- root = root . ReplaceNode ( renameNodes . First ( ) , renameNodes . First ( ) . WithoutAnnotations ( "Rename" ) ) ;
126+ root = root . ReplaceNode ( renameNodes . First ( ) , renameNodes . First ( ) . WithoutAnnotations ( rename ) ) ;
127127 }
128128
129129 while ( true )
130130 {
131- var renameTokens = root . DescendantTokens ( descendIntoTrivia : true ) . Where ( s => s . GetAnnotations ( "Rename" ) . Any ( ) ) ;
131+ var renameTokens = root . DescendantTokens ( descendIntoTrivia : true ) . Where ( s => s . GetAnnotations ( rename ) . Any ( ) ) ;
132132 if ( ! renameTokens . Any ( ) )
133133 {
134134 break ;
135135 }
136136
137- root = root . ReplaceToken ( renameTokens . First ( ) , renameTokens . First ( ) . WithoutAnnotations ( "Rename" ) ) ;
137+ root = root . ReplaceToken ( renameTokens . First ( ) , renameTokens . First ( ) . WithoutAnnotations ( rename ) ) ;
138138 }
139139
140140 solution = solution . WithDocumentSyntaxRoot ( documentId , root ) ;
You can’t perform that action at this time.
0 commit comments