459 references to Formatter
IdeBenchmarks (2)
FormatterBenchmarks.cs (2)
50
return
Formatter
.GetFormattedTextChanges(root, workspace.Services.SolutionServices, options, CancellationToken.None);
63
return
Formatter
.GetFormattedTextChanges(root, workspace.Services.SolutionServices, options, CancellationToken.None);
IdeCoreBenchmarks (3)
FormatterBenchmarks.cs (3)
54
var root = document.GetSyntaxRootAsync(CancellationToken.None).Result.WithAdditionalAnnotations(
Formatter
.Annotation);
69
var formattedDoc =
Formatter
.FormatAsync(_document,
Formatter
.Annotation, _options, CancellationToken.None).Result;
Microsoft.AspNetCore.Components.Analyzers.Tests (4)
Helpers\CodeFixVerifier.Helper.cs (2)
82
root =
Formatter
.Format(root,
Formatter
.Annotation, simplifiedDoc.Project.Solution.Workspace);
Verifiers\CodeFixVerifier.cs (2)
109
document = document.WithSyntaxRoot(
Formatter
.Format(document.GetSyntaxRootAsync().Result,
Formatter
.Annotation, document.Project.Solution.Workspace));
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (4)
Helpers\CodeFixVerifier.Helper.cs (2)
82
root =
Formatter
.Format(root,
Formatter
.Annotation, simplifiedDoc.Project.Solution.Workspace);
Verifiers\CodeFixVerifier.cs (2)
109
document = document.WithSyntaxRoot(
Formatter
.Format(document.GetSyntaxRootAsync().Result,
Formatter
.Annotation, document.Project.Solution.Workspace));
Microsoft.CodeAnalysis.CodeStyle.Fixes (23)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
133
.WithAdditionalAnnotations(
Formatter
.Annotation, s_annotation);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
121
var newRoot = root.ReplaceNode(docCommentNode, newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateLocalCodeAction.cs (1)
63
localStatement = localStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
93
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
104
.WithAdditionalAnnotations(
Formatter
.Annotation, annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
199
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
38
switchNode, switchExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
39
switchNode, switchOperation).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
418
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
433
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
88
return coalesceExpression.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
211
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
88
var newStatement = GetNewStatement(statement, objectCreation, formattingOptions, matches).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
44
=> node.WithAdditionalAnnotations(
Formatter
.Annotation, CodeGenerator.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (4)
46
.WithAdditionalAnnotations(
Formatter
.Annotation);
73
.WithAdditionalAnnotations(
Formatter
.Annotation));
96
.WithAdditionalAnnotations(
Formatter
.Annotation));
117
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
102
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (4)
129
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
143
newNextStatement.WithAdditionalAnnotations(
Formatter
.Annotation).WithLeadingTrivia(
153
(current, generator) => current.WithAdditionalAnnotations(
Formatter
.Annotation).WithPrependedLeadingTrivia(
173
declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (48)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (2)
63
(c, _) => c.WithAdditionalAnnotations(
Formatter
.Annotation));
83
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
103
editor.ReplaceNode(switchStatement, switchExpressionStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
269
node.Expression.Cast(expressionConvertedType).WithAdditionalAnnotations(
Formatter
.Annotation),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
434
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
171
.WithAdditionalAnnotations(
Formatter
.Annotation));
204
(t, g) => t.WithTrailingTrivia(ElasticSpace).WithoutAnnotations(
Formatter
.Annotation));
305
newType = newType.WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
105
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
141
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
77
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
119
var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
196
.Select(d => d.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
228
.Select(directive => directive.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
65
? node.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
73
return castExpression.Uncast().WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (3)
58
.WithAdditionalAnnotations(
Formatter
.Annotation);
67
.WithAdditionalAnnotations(
Formatter
.Annotation));
76
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
72
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
166
return proposedReplacementNode.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
86
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
33
return newCreation.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
75
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
51
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
38
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (2)
71
editor.ReplaceNode(accessorList, (current, _) => current.WithAdditionalAnnotations(
Formatter
.Annotation));
86
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
23
=> UpdateWorker(semanticModel, lambdaExpression, cancellationToken).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
89
var argument = Argument(rangeExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
159
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
85
var patternSyntax = AsPatternSyntax(pattern).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
120
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
95
return newIf.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (3)
162
a => a.WithTarget(AttributeTargetSpecifier(MethodKeyword)).WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation)));
175
.WithAdditionalAnnotations(
Formatter
.Annotation));
482
UpdateDeclaration(declaration, assignmentExpression, expressionStatement).WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
123
newDocComment = newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
131
result[i] = result[i].WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
32
? result.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
104
return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
236
.WithAdditionalAnnotations(
Formatter
.Annotation);
257
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
99
.WithAdditionalAnnotations(
Formatter
.Annotation);
109
braces.closeBrace.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
222
(currentBlock, _) => currentBlock.WithAdditionalAnnotations(
Formatter
.Annotation));
280
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
85
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (6)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
49
var formattedNewRoot =
Formatter
.Format(
81
var formattedNewRoot =
Formatter
.Format(
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
214
var formattedDocument = await
Formatter
.FormatAsync(
215
simplifiedDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
280
.WithAdditionalAnnotations(
Formatter
.Annotation);
Formatting\CSharpFormattingInteractionService.cs (1)
89
return Task.FromResult(
Formatter
.GetFormattedTextChanges(parsedDocument.Root, [formattingSpan], document.Project.Solution.Services, options, cancellationToken).ToImmutableArray());
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
936
var formattedDocument = await
Formatter
.FormatAsync(modifiedDocument, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).ConfigureAwait(false);
Formatting\FormattingEngineTests.cs (2)
442
var node =
Formatter
.Format(syntaxRoot, spans, workspace.Services.SolutionServices, options, rules: default, CancellationToken.None);
2549
var formattedRoot =
Formatter
.Format(root, workspace.Services.SolutionServices, options, CancellationToken.None);
Formatting\Indentation\CSharpFormatterTestsBase.cs (1)
87
var rules = ImmutableArray.Create(formattingRuleProvider.CreateRule(documentSyntax, position)).AddRange(
Formatter
.GetDefaultFormattingRules(document));
Formatting\Indentation\SmartIndenterEnterOnTokenTests.cs (2)
1414
Formatter
.GetDefaultFormattingRules(document),
1457
Formatter
.GetDefaultFormattingRules(document),
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3420
var rules =
Formatter
.GetDefaultFormattingRules(document);
Formatting\RazorLineFormattingOptionsTests.cs (1)
70
var formattedDocument = await
Formatter
.FormatAsync(document, spans: null, options: null, CancellationToken.None);
Microsoft.CodeAnalysis.CSharp.Features (92)
AddImport\CSharpAddImportFeatureService.cs (2)
434
.WithAdditionalAnnotations(
Formatter
.Annotation),
487
.WithAdditionalAnnotations(
Formatter
.Annotation);
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
259
var result =
Formatter
.GetFormattingResult(
ChangeSignature\CSharpChangeSignatureService.cs (1)
890
=> [..
Formatter
.GetDefaultFormattingRules(document), new ChangeSignatureFormattingRule()];
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
65
var titleComment = Comment(string.Format(" // {0}", title)).WithAdditionalAnnotations(
Formatter
.Annotation);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
306
newLocalDeclaration.WithAdditionalAnnotations(
Formatter
.Annotation));
338
.WithAdditionalAnnotations(
Formatter
.Annotation);
375
expressionToInline = expressionToInline.WithAdditionalAnnotations(
Formatter
.Annotation);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (2)
158
return replacement.ConvertToSingleLine().WithAdditionalAnnotations(
Formatter
.Annotation);
209
return rewrittenPattern.ConvertToSingleLine().WithAdditionalAnnotations(
Formatter
.Annotation, Simplifier.Annotation);
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
101
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (2)
65
.WithAdditionalAnnotations(
Formatter
.Annotation);
138
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (2)
98
CreateDefaultStatement(queryOrLinqInvocationExpression, _modifyingExpression).WithAdditionalAnnotations(
Formatter
.Annotation));
185
SyntaxFactory.IdentifierName(MethodName))).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\DefaultConverter.cs (1)
41
.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertLinq\ConvertForEachToLinqQuery\YieldReturnConverter.cs (1)
38
SyntaxFactory.ReturnStatement(queryOrLinqInvocationExpression).WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
700
forEachStatement.Statement).WithAdditionalAnnotations(
Formatter
.Annotation), queryExpressionProcessingInfo);
722
expression => forEachStatement.Statement.WithAdditionalAnnotations(
Formatter
.Annotation),
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (2)
385
var formattedRoot =
Formatter
.Format(currentRoot, SyntaxAnnotation.ElasticAnnotation, solution.Services, formattingOptions, cancellationToken);
472
[.. methodTargetingAttributes.Select(a => a.WithTarget(null).WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation))],
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
131
var statement = globalStatement.Statement.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
232
globalStatements.Add(GlobalStatement(statement).WithAdditionalAnnotations(
Formatter
.Annotation));
Copilot\CSharpCopilotCodeFixProvider.cs (1)
129
.WithAdditionalAnnotations(
Formatter
.Annotation, WarningAnnotation);
DecompiledSource\CSharpDecompiledSourceService.cs (2)
60
var formattedDoc = await
Formatter
.FormatAsync(
64
[CSharpDecompiledSourceFormattingRule.Instance, ..
Formatter
.GetDefaultFormattingRules(document)],
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
77
.WithAdditionalAnnotations(
Formatter
.Annotation)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
110
Formatter
.Annotation.AddAnnotationToSymbol(methodSymbol));
133
return container.CopyAnnotationsTo(callSiteGenerator.Generate()).WithAdditionalAnnotations(
Formatter
.Annotation);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
212
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
GenerateType\CSharpGenerateTypeService.cs (1)
752
var addedCompilationRoot = compilationRoot.AddUsingDirectives([usingDirective], addImportOptions.PlaceSystemNamespaceFirst,
Formatter
.Annotation);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (1)
53
EqualsValueClause(expression.WithoutTrivia()))])).WithAdditionalAnnotations(
Formatter
.Annotation);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (5)
127
.WithAdditionalAnnotations(
Formatter
.Annotation);
255
.WithAdditionalAnnotations(
Formatter
.Annotation);
292
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
360
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
397
Block(root.GetCurrentNode(statement)).WithAdditionalAnnotations(
Formatter
.Annotation));
IntroduceVariable\CSharpIntroduceVariableService_IntroduceQueryLocal.cs (1)
38
expression).WithAdditionalAnnotations(
Formatter
.Annotation);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (1)
177
: updatedIf.WithAdditionalAnnotations(
Formatter
.Annotation);
MetadataAsSource\CSharpMetadataAsSourceService.cs (1)
59
=> [s_memberSeparationRule, ..
Formatter
.GetDefaultFormattingRules(document)];
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (5)
155
return property.WithAdditionalAnnotations(
Formatter
.Annotation);
189
.WithAdditionalAnnotations(
Formatter
.Annotation);
202
.WithAdditionalAnnotations(
Formatter
.Annotation);
228
return accessor.WithBody(getMethodDeclaration.Body.WithAdditionalAnnotations(
Formatter
.Annotation));
277
return accessor.WithBody(body.WithAdditionalAnnotations(
Formatter
.Annotation));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
140
.WithAdditionalAnnotations(
Formatter
.Annotation);
211
.WithAdditionalAnnotations(
Formatter
.Annotation);
266
.WithAdditionalAnnotations(
Formatter
.Annotation);
277
.WithAdditionalAnnotations(
Formatter
.Annotation);
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
356
return expr.WithAdditionalAnnotations(
Formatter
.Annotation);
SimplifyTypeNames\SimplifyTypeNamesCodeFixProvider.cs (1)
55
Simplifier.Annotation,
Formatter
.Annotation, DoNotAllowVarAnnotation.Annotation);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAboveReturnCodeFixProvider.cs (2)
63
(c, _) => c.WithAdditionalAnnotations(
Formatter
.Annotation));
83
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
103
editor.ReplaceNode(switchStatement, switchExpressionStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
269
node.Expression.Cast(expressionConvertedType).WithAdditionalAnnotations(
Formatter
.Annotation),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
434
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
171
.WithAdditionalAnnotations(
Formatter
.Annotation));
204
(t, g) => t.WithTrailingTrivia(ElasticSpace).WithoutAnnotations(
Formatter
.Annotation));
305
newType = newType.WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
105
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
141
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
77
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
119
var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
196
.Select(d => d.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
228
.Select(directive => directive.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
65
? node.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
73
return castExpression.Uncast().WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (3)
58
.WithAdditionalAnnotations(
Formatter
.Annotation);
67
.WithAdditionalAnnotations(
Formatter
.Annotation));
76
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
72
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
166
return proposedReplacementNode.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
86
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
33
return newCreation.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
75
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
51
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
38
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (2)
71
editor.ReplaceNode(accessorList, (current, _) => current.WithAdditionalAnnotations(
Formatter
.Annotation));
86
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
23
=> UpdateWorker(semanticModel, lambdaExpression, cancellationToken).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
89
var argument = Argument(rangeExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
159
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
85
var patternSyntax = AsPatternSyntax(pattern).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
120
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
95
return newIf.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (3)
162
a => a.WithTarget(AttributeTargetSpecifier(MethodKeyword)).WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation)));
175
.WithAdditionalAnnotations(
Formatter
.Annotation));
482
UpdateDeclaration(declaration, assignmentExpression, expressionStatement).WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
123
newDocComment = newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
131
result[i] = result[i].WithAdditionalAnnotations(
Formatter
.Annotation);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
227
return [new SingleLinePropertyFormattingRule(), ..
Formatter
.GetDefaultFormattingRules(document)];
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
182
.WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.Workspaces (15)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3115
block = block.WithOpenBraceToken(block.OpenBraceToken.WithAdditionalAnnotations(
Formatter
.Annotation));
Formatting\CSharpSyntaxFormattingService.cs (1)
289
..
Formatter
.GetDefaultFormattingRules(_services),
Simplification\CSharpSimplificationService.cs (1)
166
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
Simplification\CSharpSimplificationService.Expander.cs (1)
1126
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
Simplification\Reducers\CSharpNameReducer.cs (1)
61
node = node.CopyAnnotationsTo(replacementNode).WithAdditionalAnnotations(
Formatter
.Annotation);
Simplification\Reducers\CSharpNameReducer.Rewriter.cs (1)
223
return result.Parenthesize().WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
32
? result.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
104
return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
236
.WithAdditionalAnnotations(
Formatter
.Annotation);
257
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
99
.WithAdditionalAnnotations(
Formatter
.Annotation);
109
braces.closeBrace.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
222
(currentBlock, _) => currentBlock.WithAdditionalAnnotations(
Formatter
.Annotation));
280
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
85
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (23)
CodeGeneration\AddAttributesTests.cs (1)
60
var formatted = await
Formatter
.FormatAsync(changedDoc, SyntaxAnnotation.ElasticAnnotation, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
CodeGeneration\AddImportsTests.cs (3)
95
var formatted = await
Formatter
.FormatAsync(imported, SyntaxAnnotation.ElasticAnnotation, formattingOptions, CancellationToken.None);
103
var formatted = await
Formatter
.FormatAsync(reduced, SyntaxAnnotation.ElasticAnnotation, formattingOptions, CancellationToken.None);
817
var formatted = await
Formatter
.FormatAsync(imported, formattingOptions, CancellationToken.None);
CodeGeneration\SymbolEditorTests.cs (3)
57
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
58
document = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
CodeGeneration\SyntaxGeneratorTests.cs (1)
4585
var elasticOnlyFormatted =
Formatter
.Format(newRoot, SyntaxAnnotation.ElasticAnnotation, _workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).ToFullString();
Formatting\FormattingElasticTriviaTests.cs (7)
89
var newCompilation =
Formatter
.Format(compilation, workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
112
var newDecl = generator.AddAttributes(decl, generator.Attribute("Some")).WithAdditionalAnnotations(
Formatter
.Annotation);
129
var formatted =
Formatter
.Format(newRoot, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
132
var elasticOnlyFormatted =
Formatter
.Format(newRoot, SyntaxAnnotation.ElasticAnnotation, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
135
var annotationFormatted =
Formatter
.Format(newRoot,
Formatter
.Annotation, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
185
var newCompilation =
Formatter
.Format(compilation, workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Formatting\FormattingMultipleSpanTests.cs (1)
169
var result =
Formatter
.Format(root, TextSpan.FromBounds(0, 0), workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Formatting\FormattingTests.cs (3)
4655
var newProperty =
Formatter
.Format(property, workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
8279
Formatter
.Format(block, new AdhocWorkspace().Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
9319
=>
Formatter
.Format(SyntaxFactory.StructDeclaration("S"), DefaultWorkspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Formatting\FormattingTreeEditTests.cs (2)
46
var result1 =
Formatter
.Format(root1, document.Project.Solution.Services, options, CancellationToken.None);
59
var result2 =
Formatter
.Format(root2, document.Project.Solution.Services, options, CancellationToken.None);
Formatting\FormattingTriviaTests.cs (2)
1752
var formatted =
Formatter
.Format(tree, workspace.Services.SolutionServices, options, CancellationToken.None);
1798
var formatted =
Formatter
.Format(tree, workspace.Services.SolutionServices, options, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures (1)
CommentSelection\AbstractCommentSelectionBase.cs (1)
154
var formattedChanges =
Formatter
.GetFormattedTextChanges(newRoot, formattingSpans, document.Project.Solution.Services, formattingOptions, rules: default, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
Formatting\CoreFormatterTestsBase.cs (4)
206
ImmutableArray<AbstractFormattingRule> rules = [formattingRuleProvider.CreateRule(documentSyntax, 0), ..
Formatter
.GetDefaultFormattingRules(document)];
215
var newRootNode =
Formatter
.Format(root, spans, workspace.Services.SolutionServices, options, rules, CancellationToken.None);
228
var result =
Formatter
.GetFormattedTextChanges(root, spans, workspace.Services.SolutionServices, options, rules, CancellationToken.None);
290
var result =
Formatter
.Format(node, workspace.Services.SolutionServices, options, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
CodeGeneration\CodeGenerationTests.cs (5)
542
.WithAdditionalAnnotations(
Formatter
.Annotation);
561
.WithAdditionalAnnotations(
Formatter
.Annotation);
613
updatedDeclarationNode = updatedDeclarationNode.WithAdditionalAnnotations(
Formatter
.Annotation);
960
var actual =
Formatter
.FormatAsync(simplified,
Formatter
.Annotation, formattingOptions, CancellationToken.None).Result.GetSyntaxRootAsync().Result.ToFullString();
MetadataAsSource\MetadataAsSourceTests.cs (1)
1954
await
Formatter
.FormatAsync(document, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Expansion\AbstractExpansionTest.vb (1)
50
document = Await
Formatter
.FormatAsync(document, cleanupOptions.FormattingOptions, CancellationToken.None)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (1)
Formatting\OmniSharpFormatter.cs (1)
18
=>
Formatter
.FormatAsync(document, spans, options.UnderlyingObject, rules: default, cancellationToken);
Microsoft.CodeAnalysis.ExternalAccess.Razor (2)
RazorCSharpFormattingInteractionService.cs (2)
68
return
Formatter
.GetFormattedTextChanges(root, span, services.SolutionServices, GetFormattingOptions(services.SolutionServices, indentationOptions), cancellationToken);
78
return
Formatter
.Format(root, services.SolutionServices, GetFormattingOptions(services.SolutionServices, indentationOptions), cancellationToken: cancellationToken);
Microsoft.CodeAnalysis.Features (82)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
60
.WithAdditionalAnnotations(
Formatter
.Annotation);
ChangeSignature\AbstractChangeSignatureService.cs (4)
406
var formattedRoot =
Formatter
.Format(
428
var formattedDoc = await
Formatter
.FormatAsync(reducedDoc, SyntaxAnnotation.ElasticAnnotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
526
newArguments.Add(argument.WithName(param.Name).WithAdditionalAnnotations(
Formatter
.Annotation));
549
newArguments.Add(paramsArrayArgument.WithName(param.Name).WithAdditionalAnnotations(
Formatter
.Annotation));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (1)
87
=>
Formatter
.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
221
=>
Formatter
.Format(node, _document.Project.Solution.Services, _options, cancellationToken);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
176
var textChanges =
Formatter
.GetFormattedTextChanges(
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (6)
414
import = import.WithAdditionalAnnotations(
Formatter
.Annotation);
628
root = root.WithAdditionalAnnotations(
Formatter
.Annotation);
632
root =
Formatter
.Format(root,
Formatter
.Annotation, services, documentOptions.FormattingOptions, cancellationToken);
669
var formattedDocument = await
Formatter
.FormatAsync(documentWithAdditionalImports,
Formatter
.Annotation, documentOptions.FormattingOptions, cancellationToken)
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (3)
133
return await
Formatter
.FormatAsync(document, _annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
222
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\ImportCompletionProviderHelpers.cs (3)
37
var importNode = syntaxGenerator.NamespaceImportDeclaration(namespaceName).WithAdditionalAnnotations(
Formatter
.Annotation);
47
var formattedDocumentWithImport = await
Formatter
.FormatAsync(documentWithImport,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
238
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertAnonymousType\AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
133
return ConvertToTuple(anonCreation).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
98
editor.ReplaceNode(property, fullProperty.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (2)
100
return foreachCollectionExpression.WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation);
146
return (TStatementSyntax)localDecl.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
50
.WithAdditionalAnnotations(
Formatter
.Annotation)
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
317
syntaxFacts.ConvertToSingleLine(expressions[index], useElasticTrivia: true).WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
713
.WithAdditionalAnnotations(
Formatter
.Annotation);
EncapsulateField\AbstractEncapsulateFieldService.cs (5)
201
document = await
Formatter
.FormatAsync(document.WithSyntaxRoot(rewrittenFieldDeclaration),
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
223
documentWithProperty = await
Formatter
.FormatAsync(documentWithProperty,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
359
Formatter
.Annotation.AddAnnotationToSymbol(propertySymbol));
ExtractInterface\AbstractExtractInterfaceService.cs (3)
296
var formattedDocument = await
Formatter
.FormatAsync(
298
Formatter
.Annotation,
349
var unformattedTypeDeclaration = syntaxGenerator.AddInterfaceType(typeDeclaration, typeReference).WithAdditionalAnnotations(
Formatter
.Annotation);
ExtractMethod\MethodExtractor.cs (3)
159
Formatter
.Format(simplifiedRoot,
Formatter
.Annotation, services, this.Options.CodeCleanupOptions.FormattingOptions, formattingRules, cancellationToken));
202
=> [GetCustomFormattingRule(document), ..
Formatter
.GetDefaultFormattingRules(document)];
Formatting\FormattingRuleUtilities.cs (1)
26
return rules.AddRange(
Formatter
.GetDefaultFormattingRules(document.LanguageServices));
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (2)
30
var formattedDocument = await
Formatter
.FormatAsync(
33
[formatBinaryRule, ..
Formatter
.GetDefaultFormattingRules(document)],
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
562
syntaxGenerator.AddParentheses(inlineMethodContext.InlineExpression.WithAdditionalAnnotations(
Formatter
.Annotation))));
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
517
updatedExpression.WithAdditionalAnnotations(
Formatter
.Annotation), parameterName, insertionIndex, named);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (3)
181
newParent.WithAdditionalAnnotations(
Formatter
.Annotation)));
261
newParent.WithAdditionalAnnotations(
Formatter
.Annotation)));
270
usingStatement.WithAdditionalAnnotations(
Formatter
.Annotation)));
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (5)
510
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
534
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
560
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
583
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
608
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
58
var formattedDoc = await
Formatter
.FormatAsync(
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
263
var formattedDocument = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, formattingOptions, cancellationToken).ConfigureAwait(false);
PullMemberUp\MembersPuller.cs (1)
386
destinationDocument = await
Formatter
.FormatAsync(destinationDocument, s_removableImportAnnotation, options.CleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
80
token.Parent.ReplaceToken(token, default(SyntaxToken)).WithAdditionalAnnotations(
Formatter
.Annotation)));
Shared\Utilities\ExtractTypeHelpers.cs (2)
110
var formattedDocument = await
Formatter
.FormatAsync(simplified, newCleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
127
return
Formatter
.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
83
var reformatSnippetNode = snippetExpressionNode.WithAdditionalAnnotations(FindSnippetAnnotation, Simplifier.Annotation, SymbolAnnotation.Create(consoleSymbol!),
Formatter
.Annotation);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (3)
154
document = await
Formatter
.FormatAsync(document, FindSnippetAnnotation, syntaxFormattingOptions, cancellationToken: cancellationToken).ConfigureAwait(false);
157
document = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, syntaxFormattingOptions, cancellationToken: cancellationToken).ConfigureAwait(false);
215
var reformatSnippetNode = snippetExpressionNode.WithAdditionalAnnotations(FindSnippetAnnotation, Simplifier.Annotation,
Formatter
.Annotation);
SplitOrMergeIfStatements\Consecutive\AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (1)
91
newCondition = newCondition.WithAdditionalAnnotations(
Formatter
.Annotation);
SplitOrMergeIfStatements\Consecutive\AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
67
leftCondition = leftCondition.WithAdditionalAnnotations(
Formatter
.Annotation);
68
rightCondition = rightCondition.WithAdditionalAnnotations(
Formatter
.Annotation);
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (1)
85
return root.ReplaceNode(outerIfOrElseIf, newIfOrElseIf.WithAdditionalAnnotations(
Formatter
.Annotation));
SplitOrMergeIfStatements\Nested\AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider.cs (1)
57
root.ReplaceNode(ifOrElseIf, outerIfOrElseIf.WithAdditionalAnnotations(
Formatter
.Annotation)));
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
133
.WithAdditionalAnnotations(
Formatter
.Annotation, s_annotation);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
121
var newRoot = root.ReplaceNode(docCommentNode, newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateLocalCodeAction.cs (1)
63
localStatement = localStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
93
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
104
.WithAdditionalAnnotations(
Formatter
.Annotation, annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
199
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
38
switchNode, switchExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
39
switchNode, switchOperation).WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
418
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
433
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
88
return coalesceExpression.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
211
.WithAdditionalAnnotations(
Formatter
.Annotation);
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
88
var newStatement = GetNewStatement(statement, objectCreation, formattingOptions, matches).WithAdditionalAnnotations(
Formatter
.Annotation);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
362
return
Formatter
.Format(newRoot, SpecializedFormattingAnnotation, document.Project.Solution.Services, options, formattingRules, cancellationToken);
Wrapping\AbstractCodeActionComputer.cs (1)
166
var formattedDocument = await
Formatter
.FormatAsync(
Microsoft.CodeAnalysis.LanguageServer.Protocol (4)
ExternalAccess\Razor\FormatNewFileHandler.cs (1)
88
root =
Formatter
.Format(root, project.Solution.Services, syntaxFormattingOptions, cancellationToken);
Features\CodeCleanup\AbstractCodeCleanupService.cs (1)
96
document = await
Formatter
.FormatAsync(document, formattingOptions, cancellationToken).ConfigureAwait(false);
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
43
var textChanges =
Formatter
.GetFormattedTextChanges(root, [formattingSpan], services, formattingOptions, rules: default, cancellationToken);
Handler\InlineCompletions\InlineCompletionsHandler.cs (1)
193
var formattingChanges =
Formatter
.GetFormattedTextChanges(root, spanToFormat, originalDocument.Project.Solution.Services, formattingOptions, cancellationToken: cancellationToken)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (12)
src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
100
.WithAdditionalAnnotations(
Formatter
.Annotation)
105
.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (1)
42
Dim yieldStatement = SyntaxFactory.YieldStatement(returnStatement.Expression).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (2)
113
Dim iteratorToken As SyntaxToken = Token(SyntaxKind.IteratorKeyword).WithAdditionalAnnotations(
Formatter
.Annotation)
132
Dim iteratorToken As SyntaxToken = Token(SyntaxKind.IteratorKeyword).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
107
Dim newCastExpression = Uncast(castExpression).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedValuesCodeFixProvider.vb (1)
71
Return proposedReplacementNode.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\UseCollectionInitializer\VisualBasicUseCollectionInitializerCodeFixProvider.vb (1)
69
Dim result = newStatement.WithLeadingTrivia(totalTrivia).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeBlockSyntaxExtensions.vb (3)
94
Return SyntaxFactory.EndClassStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
96
Return SyntaxFactory.EndInterfaceStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
98
Return SyntaxFactory.EndStructureStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicRemoveUnnecessaryImportsService.vb (1)
44
newRoot = newRoot.WithAdditionalAnnotations(
Formatter
.Annotation)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (10)
LineCommit\CommitFormatter.vb (5)
174
Return
Formatter
.GetDefaultFormattingRules(languageServices)
178
Return
Formatter
.GetDefaultFormattingRules(languageServices)
189
Return
Formatter
.GetDefaultFormattingRules(languageServices)
215
Dim coreRules =
Formatter
.GetDefaultFormattingRules(languageServices)
248
Formatter
.GetDefaultFormattingRules(languageServices), node, options))
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (3)
68
Dim formatterRules =
Formatter
.GetDefaultFormattingRules(newDocument)
73
Return Await
Formatter
.FormatAsync(
75
Formatter
.Annotation,
Utilities\CommandHandlers\AbstractImplementAbstractClassOrInterfaceCommandHandler.vb (2)
189
newDocument = Await
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(True)
Microsoft.CodeAnalysis.VisualBasic.Features (39)
AddImport\VisualBasicAddImportFeatureService.vb (1)
303
newRoot = newRoot.WithAdditionalAnnotations(CaseCorrector.Annotation,
Formatter
.Annotation)
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
738
Dim coreRules =
Formatter
.GetDefaultFormattingRules(document)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (3)
195
Dim updatedDocument = Await document.ReplaceNodeAsync(node, updatedProperty.WithAdditionalAnnotations(
Formatter
.Annotation), cancellationToken).ConfigureAwait(False)
222
Dim updatedDocument = Await document.ReplaceNodeAsync(endStatement.Parent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation), cancellationToken).ConfigureAwait(False)
257
updatedDocument = Await updatedDocument.ReplaceNodeAsync(tree, tree.WithAdditionalAnnotations(
Formatter
.Annotation), cancellationToken).ConfigureAwait(False)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (2)
206
.WithAdditionalAnnotations(
Formatter
.Annotation)
225
.WithAdditionalAnnotations(
Formatter
.Annotation)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
79
Return newNode.WithAdditionalAnnotations(
Formatter
.Annotation)
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (2)
67
Dim titleComment = SyntaxFactory.CommentTrivia(String.Format(" ' {0}", title)).WithAdditionalAnnotations(
Formatter
.Annotation)
141
attributeStatement = CType(
Formatter
.Format(attributeStatement, services, options, cancellationToken), AttributesStatementSyntax)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.ReferenceRewriter.vb (1)
61
.WithAdditionalAnnotations(
Formatter
.Annotation, Simplifier.Annotation)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (4)
196
updatedDocument = Await updatedDocument.ReplaceNodeAsync(scope, newScope.WithAdditionalAnnotations(
Formatter
.Annotation), cancellationToken).ConfigureAwait(False)
282
.WithAdditionalAnnotations(
Formatter
.Annotation)
313
.WithAdditionalAnnotations(
Formatter
.Annotation)
325
.WithAdditionalAnnotations(
Formatter
.Annotation)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (2)
49
root = root.ReplaceNode(fieldIdentifier, fieldIdentifier.WithIdentifier(newIdentifier).WithAdditionalAnnotations(annotation,
Formatter
.Annotation))
61
.WithAdditionalAnnotations(
Formatter
.Annotation)
ExtractInterface\VisualBasicExtractInterfaceService.vb (2)
75
Return implementsClause.AddInterfaceMembers(qualifiedName).WithAdditionalAnnotations(
Formatter
.Annotation)
77
Return SyntaxFactory.ImplementsClause(qualifiedName).WithAdditionalAnnotations(
Formatter
.Annotation)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (2)
91
Formatter
.Annotation.AddAnnotationToSymbol(methodSymbol))
114
Return container.CopyAnnotationsTo(callSiteGenerator.Generate()).WithAdditionalAnnotations(
Formatter
.Annotation)
GenerateType\VisualBasicGenerateTypeService.vb (1)
664
Dim addedCompilationRoot = compilationRoot.AddImportsStatement(newImport, addImportOptions.PlaceSystemNamespaceFirst,
Formatter
.Annotation, Simplifier.Annotation)
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceField.vb (1)
215
.WithAdditionalAnnotations(
Formatter
.Annotation)
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceLocal.vb (4)
95
SyntaxFactory.EndFunctionStatement()).WithAdditionalAnnotations(
Formatter
.Annotation)
128
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation, localAnnotation)
150
Dim finalInnerMostBlock = oldInnerMostCommonBlock.ReplaceStatements(statements,
Formatter
.Annotation)
176
Dim newRoot = tree.ConvertSingleLineToMultiLineExecutableBlock(oldBlock, statements,
Formatter
.Annotation)
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceQueryLocal.vb (1)
30
expression)).WithAdditionalAnnotations(
Formatter
.Annotation)
MetadataAsSource\VisualBasicMetadataAsSourceService.vb (1)
68
Dim coreRules =
Formatter
.GetDefaultFormattingRules(document)
ReplaceMethodWithProperty\VisualBasicReplaceMethodWithPropertyService.vb (1)
129
Return newPropertyDeclaration.WithAdditionalAnnotations(
Formatter
.Annotation)
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
109
Return statement.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
100
.WithAdditionalAnnotations(
Formatter
.Annotation)
105
.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (1)
42
Dim yieldStatement = SyntaxFactory.YieldStatement(returnStatement.Expression).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (2)
113
Dim iteratorToken As SyntaxToken = Token(SyntaxKind.IteratorKeyword).WithAdditionalAnnotations(
Formatter
.Annotation)
132
Dim iteratorToken As SyntaxToken = Token(SyntaxKind.IteratorKeyword).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
107
Dim newCastExpression = Uncast(castExpression).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedValuesCodeFixProvider.vb (1)
71
Return proposedReplacementNode.WithAdditionalAnnotations(
Formatter
.Annotation)
src\Analyzers\VisualBasic\CodeFixes\UseCollectionInitializer\VisualBasicUseCollectionInitializerCodeFixProvider.vb (1)
69
Dim result = newStatement.WithLeadingTrivia(totalTrivia).WithAdditionalAnnotations(
Formatter
.Annotation)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (6)
Simplification\Reducers\VisualBasicNameReducer.vb (1)
48
node = node.CopyAnnotationsTo(replacementNode).WithAdditionalAnnotations(
Formatter
.Annotation)
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (1)
45
replacementNode = node.CopyAnnotationsTo(replacementNode).WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeBlockSyntaxExtensions.vb (3)
94
Return SyntaxFactory.EndClassStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
96
Return SyntaxFactory.EndInterfaceStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
98
Return SyntaxFactory.EndStructureStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicRemoveUnnecessaryImportsService.vb (1)
44
newRoot = newRoot.WithAdditionalAnnotations(
Formatter
.Annotation)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (11)
CodeGeneration\AddImportsTests.vb (2)
101
Dim formatted = Await
Formatter
.FormatAsync(imported, SyntaxAnnotation.ElasticAnnotation, formattingOptions, CancellationToken.None)
108
Dim formatted = Await
Formatter
.FormatAsync(reduced, SyntaxAnnotation.ElasticAnnotation, formattingOptions, CancellationToken.None)
Formatting\FormattingTests.vb (5)
3021
Dim result =
Formatter
.GetFormattedTextChanges(root, workspace.Services.SolutionServices, options, CancellationToken.None)
3028
Dim result2 =
Formatter
.GetFormattedTextChanges(root, workspace.Services.SolutionServices, options, CancellationToken.None)
3788
Dim result =
Formatter
.Format(root, goo, workspace.Services.SolutionServices, VisualBasicSyntaxFormattingOptions.Default, CancellationToken.None).ToString()
4209
document = Await
Formatter
.FormatAsync(newDocument, VisualBasicSyntaxFormattingOptions.Default, CancellationToken.None)
4605
Dim formatted =
Formatter
.Format(tree, workspace.Services.SolutionServices, options, CancellationToken.None)
Formatting\VisualBasicFormattingTestBase.vb (3)
67
Dim changes =
Formatter
.GetFormattedTextChanges(Await syntaxTree.GetRootAsync(), workspace.Services.SolutionServices, options, CancellationToken.None)
70
changes =
Formatter
.GetFormattedTextChanges(Await syntaxTree.GetRootAsync(), (Await syntaxTree.GetRootAsync()).FullSpan, workspace.Services.SolutionServices, options, CancellationToken.None)
76
changes =
Formatter
.GetFormattedTextChanges(Await syntaxTree.GetRootAsync(), spans, workspace.Services.SolutionServices, options, CancellationToken.None)
OrganizeImports\OrganizeImportsTests.vb (1)
64
Dim formattedDocument = Await
Formatter
.FormatAsync(organizedDocument, formattingOptions, CancellationToken.None)
Microsoft.CodeAnalysis.Workspaces (17)
CodeActions\CodeAction.cs (1)
472
/// Formatting nodes annotated with <see cref="
Formatter
.Annotation"/>
CodeActions\CodeAction_Cleanup.cs (3)
52
var document1 = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, options.FormattingOptions, cancellationToken).ConfigureAwait(false);
55
var document2 = await
Formatter
.FormatAsync(document1, SyntaxAnnotation.ElasticAnnotation, options.FormattingOptions, cancellationToken).ConfigureAwait(false);
Formatting\AbstractFormattingService.cs (1)
21
return
Formatter
.FormatAsync(document, spans, syntaxFormattingOptions, rules: default, cancellationToken);
Rename\ConflictEngine\RenamedSpansTracker.cs (2)
159
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
44
=> node.WithAdditionalAnnotations(
Formatter
.Annotation, CodeGenerator.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (4)
46
.WithAdditionalAnnotations(
Formatter
.Annotation);
73
.WithAdditionalAnnotations(
Formatter
.Annotation));
96
.WithAdditionalAnnotations(
Formatter
.Annotation));
117
.WithAdditionalAnnotations(
Formatter
.Annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
102
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (4)
129
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
143
newNextStatement.WithAdditionalAnnotations(
Formatter
.Annotation).WithLeadingTrivia(
153
(current, generator) => current.WithAdditionalAnnotations(
Formatter
.Annotation).WithPrependedLeadingTrivia(
173
declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Formatting\FormattingTestBase.cs (3)
69
var newRootNode =
Formatter
.Format(root, spans, services, options, rules: default, CancellationToken.None);
86
var result =
Formatter
.GetFormattedTextChanges(root, spans, services, options);
94
var idempotentResult =
Formatter
.GetFormattedTextChanges(resultRoot, adjustedSpans, services, options);
Microsoft.CodeAnalysis.Workspaces.UnitTests (11)
Editing\SyntaxEditorTests.cs (1)
30
var formatted =
Formatter
.Format(node, EmptyWorkspace.Services.SolutionServices, options, CancellationToken.None);
Formatter\FormatterTests.cs (8)
55
var formattedDocument = await
Formatter
.FormatAsync(document, spans: null, options: null, CancellationToken.None);
92
var formattedDocument = await
Formatter
.FormatAsync(document, spans: null, options, CancellationToken.None);
121
ValidateCSharpOptions((CSharpSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(csDocument, updatedOptions, CancellationToken.None)).Syntax!);
122
ValidateVisualBasicOptions((VisualBasicSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(vbDocument, updatedOptions, CancellationToken.None)).Syntax!);
131
ValidateCSharpOptions((CSharpSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(csDocumentWithUpdatedOptions, optionSet: null, CancellationToken.None)).Syntax!);
132
ValidateVisualBasicOptions((VisualBasicSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(vbDocumentWithUpdatedOptions, optionSet: null, CancellationToken.None)).Syntax!);
133
ValidateOrganizeImportsOptions(await
Formatter
.GetOrganizeImportsOptionsAsync(csDocumentWithUpdatedOptions, CancellationToken.None));
134
ValidateOrganizeImportsOptions(await
Formatter
.GetOrganizeImportsOptionsAsync(vbDocumentWithUpdatedOptions, CancellationToken.None));
FormattingTests.cs (1)
86
var formattedRoot =
Formatter
.Format(tree.GetRoot(), workspace.Services.SolutionServices, options, CancellationToken.None);
SolutionTests\SolutionTests.cs (1)
3164
var newRoot = await
Formatter
.FormatAsync(document, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).Result.GetSyntaxRootAsync();
Microsoft.ML.CodeGenerator (1)
Utils.cs (1)
189
trainProgramCSFileContent =
Formatter
.Format(syntaxNode, new AdhocWorkspace()).ToFullString();
Microsoft.VisualStudio.LanguageServices (6)
Implementation\AbstractEditorFactory.cs (1)
352
var formattedRoot =
Formatter
.Format(rootToFormat, workspace.Services.SolutionServices, cleanupOptions.FormattingOptions, cancellationToken);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
74
[ruleFactory.CreateRule(documentSyntax, start), ..
Formatter
.GetDefaultFormattingRules(document.Project.Services)],
Venus\ContainedDocument.cs (1)
812
[.. venusFormattingRules, ..
Formatter
.GetDefaultFormattingRules(document)],
Venus\ContainedLanguageCodeSupport.cs (3)
229
newRoot =
Formatter
.Format(
231
Formatter
.Annotation,
234
[additionalFormattingRule, ..
Formatter
.GetDefaultFormattingRules(targetDocument)],
Microsoft.VisualStudio.LanguageServices.CSharp (3)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (3)
101
var formattedDocument = await
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(true);
143
newUsings.Add(candidateUsing.WithAdditionalAnnotations(
Formatter
.Annotation).WithAppendedTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed));
Microsoft.VisualStudio.LanguageServices.VisualBasic (8)
CodeModel\VisualBasicCodeModelService.vb (5)
1331
Dim newDeclarator = declarator.RemoveNode(node, SyntaxRemoveOptions.KeepEndOfLine).WithAdditionalAnnotations(
Formatter
.Annotation)
1344
Dim newDeclaration = declaration.RemoveNode(node, SyntaxRemoveOptions.KeepEndOfLine).WithAdditionalAnnotations(
Formatter
.Annotation)
1372
Dim newArgumentList = argumentList.RemoveNode(node, SyntaxRemoveOptions.KeepEndOfLine).WithAdditionalAnnotations(
Formatter
.Annotation)
1379
Dim newParameterList = parameterList.RemoveNode(node, SyntaxRemoveOptions.KeepEndOfLine).WithAdditionalAnnotations(
Formatter
.Annotation)
3939
.WithAdditionalAnnotations(
Formatter
.Annotation)
Snippets\VisualBasicSnippetExpansionLanguageHelper.vb (3)
70
Dim formattedDocument = Await
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(True)
160
importsToAdd.Add(filteredImportsStatement.WithAdditionalAnnotations(
Formatter
.Annotation) _
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
144
.WithAdditionalAnnotations(
Formatter
.Annotation);
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (2)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (2)
155
WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation)
160
WithAdditionalAnnotations(
Formatter
.Annotation)