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