File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,15 @@ public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext con
132132
133133 // We make an optimistic attempt at fixing corner cases.
134134 var cleanupChanges = CleanupDocument ( changedContext , linePositionSpanAfterFormatting ) ;
135- var cleanedText = formattedText . WithChanges ( cleanupChanges ) ;
136- context . Logger ? . LogSourceText ( "AfterCleanupDocument" , cleanedText ) ;
135+ var cleanedText = formattedText ;
137136
138- changedContext = await changedContext . WithTextAsync ( cleanedText , cancellationToken ) . ConfigureAwait ( false ) ;
137+ if ( ! cleanupChanges . IsEmpty )
138+ {
139+ cleanedText = formattedText . WithChanges ( cleanupChanges ) ;
140+ context . Logger ? . LogSourceText ( "AfterCleanupDocument" , cleanedText ) ;
141+
142+ changedContext = await changedContext . WithTextAsync ( cleanedText , cancellationToken ) . ConfigureAwait ( false ) ;
143+ }
139144
140145 // At this point we should have applied all edits that adds/removes newlines.
141146 // Let's now ensure the indentation of each of those lines is correct.
You can’t perform that action at this time.
0 commit comments