3 instantiations of FormattingContext
Microsoft.CodeAnalysis.Razor.Workspaces (3)
Formatting\FormattingContext.cs (3)
240var newContext = new FormattingContext( 280return new FormattingContext( 297return new FormattingContext(
92 references to FormattingContext
Microsoft.CodeAnalysis.Razor.Workspaces (60)
Formatting\CSharpFormatter.cs (6)
23FormattingContext context, 37FormattingContext context, 69FormattingContext context, 100FormattingContext context, 247FormattingContext context, 337private static int GetIndentationOffsetFromLine(FormattingContext context, TextLine line)
Formatting\FormattingContext.cs (4)
232public async Task<FormattingContext> WithTextAsync(SourceText changedText, CancellationToken cancellationToken) 240var newContext = new FormattingContext( 271public static FormattingContext CreateForOnTypeFormatting( 291public static FormattingContext Create(
Formatting\FormattingUtilities.cs (7)
240public static void GetOriginalDocumentChangesFromLineInfo(FormattingContext context, SourceText originalText, ImmutableArray<LineInfo> formattedLineInfo, SourceText formattedText, ILogger logger, Func<int, bool>? shouldKeepInsertedNewlineAtPosition, ref PooledArrayBuilder<TextChange> formattingChanges, out int lastFormattedTextLine) 440private static int GetFixedIndentationWidth(FormattingContext context, LineInfo lineInfo) 446private static string GetAdjustedIndentationString(FormattingContext context, TextLine formattedLine, int fixedIndentationWidth) 461private static string GetAdjustedFormattedLineText(FormattingContext context, TextLine formattedLine, int fixedIndentationWidth, int end) 483FormattingContext context, 563FormattingContext context, 679FormattingContext context,
Formatting\IFormattingPass.cs (1)
13Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken);
Formatting\IFormattingValidationPass.cs (1)
13Task<bool> IsValidAsync(FormattingContext formattingContext, ImmutableArray<TextChange> changes, CancellationToken cancellationToken);
Formatting\Passes\CSharpFormattingPass.cs (2)
31public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 35var changedContext = await context.WithTextAsync(changedText, cancellationToken).ConfigureAwait(false);
Formatting\Passes\CSharpOnTypeFormattingPass.cs (11)
46public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 130var changedContext = await context.WithTextAsync(formattedText, cancellationToken).ConfigureAwait(false); 218private static ImmutableArray<TextChange> FilterCSharpTextChanges(FormattingContext context, ImmutableArray<TextChange> changes) 278private static ImmutableArray<TextChange> CleanupDocument(FormattingContext context, LinePositionSpan spanAfterFormatting) 308private static void CleanupSourceMappingStart(FormattingContext context, LinePositionSpan sourceMappingRange, ref PooledArrayBuilder<TextChange> changes, out bool newLineAdded) 438private static void CleanupSourceMappingEnd(FormattingContext context, LinePositionSpan sourceMappingRange, ref PooledArrayBuilder<TextChange> changes, bool newLineWasAddedAtStart) 552private async Task<ImmutableArray<TextChange>> AdjustIndentationAsync(FormattingContext context, int startLine, int endLineInclusive, HostWorkspaceServices hostWorkspaceServices, ILogger logger, CancellationToken cancellationToken) 851private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) 854private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements, out RazorSyntaxNode? foundOwner) 857private static bool ShouldFormatLine(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) 860private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, ShouldFormatOptions options, out RazorSyntaxNode? foundOwner)
Formatting\Passes\FormattingContentValidationPass.cs (1)
23public Task<bool> IsValidAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken)
Formatting\Passes\FormattingDiagnosticValidationPass.cs (2)
25public async Task<bool> IsValidAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 31var changedContext = await context.WithTextAsync(changedText, cancellationToken).ConfigureAwait(false);
Formatting\Passes\HtmlFormattingPass.cs (3)
29public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 87private async Task<ImmutableArray<TextChange>> FilterIncomingChangesAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 346public Task<ImmutableArray<TextChange>> FilterIncomingChangesAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken)
Formatting\Passes\HtmlOnTypeFormattingPass.cs (5)
21public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 32var changedContext = context; 58private static ImmutableArray<TextChange> FilterIncomingChanges(FormattingContext context, ImmutableArray<TextChange> changes) 79private static ImmutableArray<TextChange> AdjustRazorIndentation(FormattingContext context) 196private static bool IsPartOfHtmlTag(FormattingContext context, int position)
Formatting\Passes\RazorFormattingPass.cs (12)
27public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext context, ImmutableArray<TextChange> changes, CancellationToken cancellationToken) 32var changedContext = context; 55private static ImmutableArray<TextChange> FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) 72private static void TryFormatBlocks(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 82private static bool TryFormatSectionBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 137private static bool TryFormatFunctionsBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 178private static bool TryFormatCSharpExplicitTransition(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 200private static bool TryFormatComplexCSharpBlock(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 222private static bool TryFormatHtmlInCSharp(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 240private static void TryFormatCSharpBlockStructure(FormattingContext context, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, RazorSyntaxNode node) 349private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, ref PooledArrayBuilder<TextChange> changes, RazorSourceDocument source, FormattingContext context, bool forceNewLine) 374private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, ref PooledArrayBuilder<TextChange> changes)
Formatting\RazorFormattingService.cs (4)
106var context = FormattingContext.Create( 298var context = FormattingContext.CreateForOnTypeFormatting(
Formatting\SnippetFormatter.cs (1)
13public static bool TryGetSnippetWithAdjustedIndentation(FormattingContext formattingContext, string snippetText, int hostDocumentIndex, [NotNullWhen(true)] out string? newSnippetText)
Microsoft.CodeAnalysis.Remote.Razor (2)
InlineCompletion\RemoteInlineCompletionService.cs (2)
72var formattingContext = FormattingContext.Create(context.Snapshot, codeDocument, options, logger: null);
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (15)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\DocumentFormattingTest.cs (3)
3852FormattingContext.SkipValidateComponents = true; 3919FormattingContext.SkipValidateComponents = true; 3969FormattingContext.SkipValidateComponents = true;
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingContentValidationPassTest.cs (5)
31var context = CreateFormattingContext(source); 51var context = CreateFormattingContext(source); 69private static FormattingContext CreateFormattingContext 85var context = FormattingContext.Create(
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingDiagnosticValidationPassTest.cs (5)
30var context = await CreateFormattingContextAsync(source); 51var context = await CreateFormattingContextAsync(source); 68private async Task<FormattingContext> CreateFormattingContextAsync( 84var context = FormattingContext.Create(
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\HtmlFormattingPassTest.cs (2)
145var context = FormattingContext.Create(snapshot,
Microsoft.VisualStudioCode.RazorExtension.UnitTests (15)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\DocumentFormattingTest.cs (3)
3852FormattingContext.SkipValidateComponents = true; 3919FormattingContext.SkipValidateComponents = true; 3969FormattingContext.SkipValidateComponents = true;
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingContentValidationPassTest.cs (5)
31var context = CreateFormattingContext(source); 51var context = CreateFormattingContext(source); 69private static FormattingContext CreateFormattingContext 85var context = FormattingContext.Create(
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\FormattingDiagnosticValidationPassTest.cs (5)
30var context = await CreateFormattingContextAsync(source); 51var context = await CreateFormattingContextAsync(source); 68private async Task<FormattingContext> CreateFormattingContextAsync( 84var context = FormattingContext.Create(
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Formatting\HtmlFormattingPassTest.cs (2)
145var context = FormattingContext.Create(snapshot,