@@ -46,21 +46,22 @@ public static async Task<IReadOnlyDictionary<int, int>> GetCSharpIndentationAsyn
4646 FormattingContext context ,
4747 HashSet < int > projectedDocumentLocations ,
4848 HostWorkspaceServices hostWorkspaceServices ,
49+ RazorCSharpSyntaxFormattingOptions ? formattingOptionsOverride ,
4950 CancellationToken cancellationToken )
5051 {
5152 // Sorting ensures we count the marker offsets correctly.
5253 // We also want to ensure there are no duplicates to avoid duplicate markers.
5354 var filteredLocations = projectedDocumentLocations . OrderAsArray ( ) ;
5455
55- var indentations = await GetCSharpIndentationCoreAsync ( context , filteredLocations , hostWorkspaceServices , cancellationToken ) . ConfigureAwait ( false ) ;
56+ var indentations = await GetCSharpIndentationCoreAsync ( context , filteredLocations , hostWorkspaceServices , formattingOptionsOverride , cancellationToken ) . ConfigureAwait ( false ) ;
5657 return indentations ;
5758 }
5859
5960 private ImmutableArray < TextChange > MapEditsToHostDocument ( RazorCodeDocument codeDocument , ImmutableArray < TextChange > csharpEdits )
6061 {
6162 var actualEdits = _documentMappingService . GetHostDocumentEdits ( codeDocument . GetRequiredCSharpDocument ( ) , csharpEdits ) ;
6263
63- return actualEdits . ToImmutableArray ( ) ;
64+ return [ .. actualEdits ] ;
6465 }
6566
6667 private static async Task < ImmutableArray < TextChange > > GetFormattingEditsAsync (
@@ -77,10 +78,15 @@ private static async Task<ImmutableArray<TextChange>> GetFormattingEditsAsync(
7778 Assumes . NotNull ( root ) ;
7879
7980 var changes = RazorCSharpFormattingInteractionService . GetFormattedTextChanges ( hostWorkspaceServices , root , spanToFormat , indentationOptions , formattingOptionsOverride , cancellationToken ) ;
80- return changes . ToImmutableArray ( ) ;
81+ return [ .. changes ] ;
8182 }
8283
83- private static async Task < Dictionary < int , int > > GetCSharpIndentationCoreAsync ( FormattingContext context , ImmutableArray < int > projectedDocumentLocations , HostWorkspaceServices hostWorkspaceServices , CancellationToken cancellationToken )
84+ private static async Task < Dictionary < int , int > > GetCSharpIndentationCoreAsync (
85+ FormattingContext context ,
86+ ImmutableArray < int > projectedDocumentLocations ,
87+ HostWorkspaceServices hostWorkspaceServices ,
88+ RazorCSharpSyntaxFormattingOptions ? formattingOptionsOverride ,
89+ CancellationToken cancellationToken )
8490 {
8591 // No point calling the C# formatting if we won't be interested in any of its work anyway
8692 if ( projectedDocumentLocations . Length == 0 )
@@ -96,7 +102,7 @@ private static async Task<Dictionary<int, int>> GetCSharpIndentationCoreAsync(Fo
96102
97103 // At this point, we have added all the necessary markers and attached annotations.
98104 // Let's invoke the C# formatter and hope for the best.
99- var formattedRoot = RazorCSharpFormattingInteractionService . Format ( hostWorkspaceServices , root , context . Options . ToIndentationOptions ( ) , cancellationToken ) ;
105+ var formattedRoot = RazorCSharpFormattingInteractionService . Format ( hostWorkspaceServices , root , context . Options . ToIndentationOptions ( ) , formattingOptionsOverride , cancellationToken ) ;
100106 var formattedText = formattedRoot . GetText ( ) ;
101107
102108 var desiredIndentationMap = new Dictionary < int , int > ( ) ;
0 commit comments