446 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.CodeAnalysis.CodeStyle.Fixes (23)
AbstractAddDocCommentNodesCodeFixProvider.cs (1)
121
var newRoot = root.ReplaceNode(docCommentNode, newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation));
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
93
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
104
.WithAdditionalAnnotations(
Formatter
.Annotation, annotation);
AbstractMoveDeclarationNearReferenceService.cs (4)
128
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
142
newNextStatement.WithAdditionalAnnotations(
Formatter
.Annotation).WithLeadingTrivia(
152
(current, generator) => current.WithAdditionalAnnotations(
Formatter
.Annotation).WithPrependedLeadingTrivia(
172
declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
AbstractPopulateSwitchCodeFixProvider.cs (1)
199
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
38
switchNode, switchExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
39
switchNode, switchOperation).WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
407
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
422
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
657
editor.ReplaceNode(node, replacement.WithAdditionalAnnotations(
Formatter
.Annotation));
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
97
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractUseNullPropagationCodeFixProvider.cs (1)
190
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
98
.WithAdditionalAnnotations(
Formatter
.Annotation);
AddParameterEditor.cs (4)
46
.WithAdditionalAnnotations(
Formatter
.Annotation);
73
.WithAdditionalAnnotations(
Formatter
.Annotation));
96
.WithAdditionalAnnotations(
Formatter
.Annotation));
117
.WithAdditionalAnnotations(
Formatter
.Annotation));
AddParameterService.cs (1)
125
.WithAdditionalAnnotations(
Formatter
.Annotation);
CodeGenerationHelpers.cs (1)
47
=> node.WithAdditionalAnnotations(
Formatter
.Annotation, CodeGenerator.Annotation);
UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
92
return coalesceExpression.WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (39)
AssignOutParametersAboveReturnCodeFixProvider.cs (2)
67
(c, _) => c.WithAdditionalAnnotations(
Formatter
.Annotation));
87
.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertNamespaceTransform.cs (1)
258
semicolonToken: default).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
107
editor.ReplaceNode(switchStatement, switchExpressionStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
269
node.Expression.Cast(expressionConvertedType).WithAdditionalAnnotations(
Formatter
.Annotation),
ConvertToRecordEngine.cs (1)
417
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpAddYieldCodeFixProvider.cs (1)
81
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpCodeGenerationHelpers.cs (1)
29
? result.WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpInlineDeclarationCodeFixProvider.cs (2)
217
(t, g) => t.WithTrailingTrivia(SyntaxFactory.ElasticSpace).WithoutAnnotations(
Formatter
.Annotation));
304
newType = newType.WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpIsAndCastCheckCodeFixProvider.cs (1)
103
return newIf.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
118
var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
67
? node.WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
80
return castExpression.Uncast().WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (3)
66
.WithAdditionalAnnotations(
Formatter
.Annotation);
75
.WithAdditionalAnnotations(
Formatter
.Annotation));
84
.WithAdditionalAnnotations(
Formatter
.Annotation));
CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
229
.WithAdditionalAnnotations(
Formatter
.Annotation);
250
.WithAdditionalAnnotations(
Formatter
.Annotation));
CSharpSimplificationHelpers.cs (1)
85
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
91
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpSyntaxFactsService.cs (2)
99
.WithAdditionalAnnotations(
Formatter
.Annotation);
109
braces.closeBrace.WithAdditionalAnnotations(
Formatter
.Annotation));
CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
79
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
56
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
42
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseLocalFunctionCodeFixProvider.cs (1)
167
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
91
var patternSyntax = AsPatternSyntax(pattern).WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseRangeOperatorCodeFixProvider.cs (1)
92
var argument = Argument(rangeExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
111
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
151
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
30
.WithAdditionalAnnotations(
Formatter
.Annotation);
MisplacedUsingDirectivesCodeFixProvider.cs (2)
198
.Select(d => d.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
230
.Select(directive => directive.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
TypeDeclarationSyntaxExtensions.cs (1)
104
return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(
Formatter
.Annotation);
UseExpressionBodyCodeFixProvider.cs (2)
73
editor.ReplaceNode(accessorList, (current, _) => current.WithAdditionalAnnotations(
Formatter
.Annotation));
88
.WithAdditionalAnnotations(
Formatter
.Annotation);
UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
19
=> UpdateWorker(semanticModel, originalDeclaration, currentDeclaration).WithAdditionalAnnotations(
Formatter
.Annotation);
UseSimpleUsingStatementCodeFixProvider.cs (1)
103
result[i] = result[i].WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (8)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
47
var formattedNewRoot =
Formatter
.Format(
79
var formattedNewRoot =
Formatter
.Format(
DecompiledSource\CSharpDecompiledSourceService.cs (2)
72
var formattedDoc = await
Formatter
.FormatAsync(
76
CSharpDecompiledSourceFormattingRule.Instance.Concat(
Formatter
.GetDefaultFormattingRules(document)),
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (3)
177
var formattedDocument =
Formatter
.FormatAsync(simplifiedDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).WaitAndGetResult(cancellationToken);
220
.WithAdditionalAnnotations(
Formatter
.Annotation);
Formatting\CSharpFormattingInteractionService.cs (1)
100
return Task.FromResult(
Formatter
.GetFormattedTextChanges(parsedDocument.Root, SpecializedCollections.SingletonEnumerable(formattingSpan), document.Project.Solution.Services, options, cancellationToken).ToImmutableArray());
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
937
var formattedDocument = await
Formatter
.FormatAsync(modifiedDocument, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).ConfigureAwait(false);
Formatting\FormattingEngineTests.cs (2)
421
var node =
Formatter
.Format(syntaxRoot, spans, workspace.Services.SolutionServices, options, rules: null, CancellationToken.None);
2326
var formattedRoot =
Formatter
.Format(root, workspace.Services.SolutionServices, options, CancellationToken.None);
Formatting\Indentation\CSharpFormatterTestsBase.cs (1)
89
var rules = ImmutableArray.Create(formattingRuleProvider.CreateRule(documentSyntax, position)).AddRange(
Formatter
.GetDefaultFormattingRules(document));
Formatting\Indentation\SmartIndenterEnterOnTokenTests.cs (2)
1424
Formatter
.GetDefaultFormattingRules(document),
1467
Formatter
.GetDefaultFormattingRules(document),
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (1)
3418
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 (81)
AddImport\CSharpAddImportFeatureService.cs (2)
432
.WithAdditionalAnnotations(
Formatter
.Annotation),
485
.WithAdditionalAnnotations(
Formatter
.Annotation);
AssignOutParametersAboveReturnCodeFixProvider.cs (2)
67
(c, _) => c.WithAdditionalAnnotations(
Formatter
.Annotation));
87
.WithAdditionalAnnotations(
Formatter
.Annotation));
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
247
var result =
Formatter
.GetFormattingResult(
ChangeSignature\CSharpChangeSignatureService.cs (1)
880
=>
Formatter
.GetDefaultFormattingRules(document).Concat(new ChangeSignatureFormattingRule());
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
63
var titleComment = SyntaxFactory.Comment(string.Format(" // {0}", title)).WithAdditionalAnnotations(
Formatter
.Annotation);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
312
newLocalDeclaration.WithAdditionalAnnotations(
Formatter
.Annotation));
344
.WithAdditionalAnnotations(
Formatter
.Annotation);
381
expressionToInline = expressionToInline.WithAdditionalAnnotations(
Formatter
.Annotation);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (2)
140
return replacement.ConvertToSingleLine().WithAdditionalAnnotations(
Formatter
.Annotation);
191
return rewrittenPattern.ConvertToSingleLine().WithAdditionalAnnotations(
Formatter
.Annotation, Simplifier.Annotation);
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
101
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (2)
67
.WithAdditionalAnnotations(
Formatter
.Annotation);
141
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (2)
105
CreateDefaultStatement(queryOrLinqInvocationExpression, _modifyingExpression).WithAdditionalAnnotations(
Formatter
.Annotation));
193
SyntaxFactory.IdentifierName(MethodName))).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertLinq\ConvertForEachToLinqQuery\DefaultConverter.cs (1)
44
.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertLinq\ConvertForEachToLinqQuery\YieldReturnConverter.cs (1)
45
SyntaxFactory.ReturnStatement(queryOrLinqInvocationExpression).WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
709
forEachStatement.Statement).WithAdditionalAnnotations(
Formatter
.Annotation), queryExpressionProcessingInfo);
731
expression => forEachStatement.Statement.WithAdditionalAnnotations(
Formatter
.Annotation),
ConvertNamespaceTransform.cs (1)
258
semicolonToken: default).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
134
var statement = globalStatement.Statement.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
232
globalStatements.Add(GlobalStatement(statement).WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
107
editor.ReplaceNode(switchStatement, switchExpressionStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
269
node.Expression.Cast(expressionConvertedType).WithAdditionalAnnotations(
Formatter
.Annotation),
ConvertToRecordEngine.cs (1)
417
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpAddYieldCodeFixProvider.cs (1)
81
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpInlineDeclarationCodeFixProvider.cs (2)
217
(t, g) => t.WithTrailingTrivia(SyntaxFactory.ElasticSpace).WithoutAnnotations(
Formatter
.Annotation));
304
newType = newType.WithoutTrivia().WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpIsAndCastCheckCodeFixProvider.cs (1)
103
return newIf.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
118
var newReturnType = returnTypeSyntax.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
67
? node.WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
80
return castExpression.Uncast().WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (3)
66
.WithAdditionalAnnotations(
Formatter
.Annotation);
75
.WithAdditionalAnnotations(
Formatter
.Annotation));
84
.WithAdditionalAnnotations(
Formatter
.Annotation));
CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
91
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
79
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
56
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
42
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseLocalFunctionCodeFixProvider.cs (1)
167
.WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
91
var patternSyntax = AsPatternSyntax(pattern).WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpUseRangeOperatorCodeFixProvider.cs (1)
92
var argument = Argument(rangeExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
81
.WithAdditionalAnnotations(
Formatter
.Annotation)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
122
Formatter
.Annotation.AddAnnotationToSymbol(methodSymbol)));
146
return container.CopyAnnotationsTo(callSiteGenerator.Generate()).WithAdditionalAnnotations(
Formatter
.Annotation);
FullyQualify\CSharpFullyQualifyService.cs (1)
49
.WithAdditionalAnnotations(
Formatter
.Annotation);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
211
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
GenerateType\CSharpGenerateTypeService.cs (1)
804
var addedCompilationRoot = compilationRoot.AddUsingDirectives(new[] { usingDirective }, addImportOptions.PlaceSystemNamespaceFirst,
Formatter
.Annotation);
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (1)
84
.WithAdditionalAnnotations(
Formatter
.Annotation);
InitializeParameter\InitializeParameterHelpers.cs (1)
111
(currentBlock, _) => currentBlock.WithAdditionalAnnotations(
Formatter
.Annotation));
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (1)
51
SyntaxFactory.EqualsValueClause(expression.WithoutTrivia()))))).WithAdditionalAnnotations(
Formatter
.Annotation);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (4)
110
.WithAdditionalAnnotations(
Formatter
.Annotation);
242
.WithAdditionalAnnotations(
Formatter
.Annotation);
292
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
329
SyntaxFactory.Block(root.GetCurrentNode(statement)).WithAdditionalAnnotations(
Formatter
.Annotation));
IntroduceVariable\CSharpIntroduceVariableService_IntroduceQueryLocal.cs (1)
38
expression).WithAdditionalAnnotations(
Formatter
.Annotation);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (1)
178
: updatedIf.WithAdditionalAnnotations(
Formatter
.Annotation);
InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
111
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
151
newStatement = newStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
MetadataAsSource\CSharpMetadataAsSourceService.cs (1)
59
=> s_memberSeparationRule.Concat(
Formatter
.GetDefaultFormattingRules(document));
MisplacedUsingDirectivesCodeFixProvider.cs (2)
198
.Select(d => d.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
230
.Select(directive => directive.WithAdditionalAnnotations(
Formatter
.Annotation, s_warningAnnotation));
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (5)
152
return property.WithAdditionalAnnotations(
Formatter
.Annotation);
185
.WithAdditionalAnnotations(
Formatter
.Annotation);
198
.WithAdditionalAnnotations(
Formatter
.Annotation);
224
return accessor.WithBody(getMethodDeclaration.Body.WithAdditionalAnnotations(
Formatter
.Annotation));
273
return accessor.WithBody(body.WithAdditionalAnnotations(
Formatter
.Annotation));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
140
.WithAdditionalAnnotations(
Formatter
.Annotation);
211
.WithAdditionalAnnotations(
Formatter
.Annotation);
269
.WithAdditionalAnnotations(
Formatter
.Annotation);
280
.WithAdditionalAnnotations(
Formatter
.Annotation);
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
354
return expr.WithAdditionalAnnotations(
Formatter
.Annotation);
SimplifyTypeNames\SimplifyTypeNamesCodeFixProvider.cs (1)
55
Simplifier.Annotation,
Formatter
.Annotation, DoNotAllowVarAnnotation.Annotation);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
87
rules.AddRange(
Formatter
.GetDefaultFormattingRules(document));
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
186
.WithAdditionalAnnotations(
Formatter
.Annotation);
UseExpressionBodyCodeFixProvider.cs (2)
73
editor.ReplaceNode(accessorList, (current, _) => current.WithAdditionalAnnotations(
Formatter
.Annotation));
88
.WithAdditionalAnnotations(
Formatter
.Annotation);
UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
19
=> UpdateWorker(semanticModel, originalDeclaration, currentDeclaration).WithAdditionalAnnotations(
Formatter
.Annotation);
UseSimpleUsingStatementCodeFixProvider.cs (1)
103
result[i] = result[i].WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.Workspaces (15)
CSharpCodeGenerationHelpers.cs (1)
29
? result.WithAdditionalAnnotations(
Formatter
.Annotation)
CSharpRemoveUnnecessaryImportsService.cs (2)
28
using Formatter = Microsoft.CodeAnalysis.Formatting.
Formatter
;
82
var formattedRoot =
Formatter
.Format(newRoot, spans, provider, formattingOptions, rules: null, cancellationToken);
CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (2)
229
.WithAdditionalAnnotations(
Formatter
.Annotation);
250
.WithAdditionalAnnotations(
Formatter
.Annotation));
CSharpSimplificationHelpers.cs (1)
85
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
CSharpSyntaxFactsService.cs (2)
99
.WithAdditionalAnnotations(
Formatter
.Annotation);
109
braces.closeBrace.WithAdditionalAnnotations(
Formatter
.Annotation));
Formatting\CSharpSyntaxFormattingService.cs (1)
322
.AddRange(
Formatter
.GetDefaultFormattingRules(_services));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
30
.WithAdditionalAnnotations(
Formatter
.Annotation);
Simplification\CSharpSimplificationService.cs (1)
167
tokenWithLeadingWhitespace = token.WithLeadingTrivia(SyntaxFactory.ElasticMarker).WithAdditionalAnnotations(
Formatter
.Annotation);
Simplification\CSharpSimplificationService.Expander.cs (1)
1125
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
Simplification\Reducers\CSharpNameReducer.cs (1)
63
node = node.CopyAnnotationsTo(replacementNode).WithAdditionalAnnotations(
Formatter
.Annotation);
Simplification\Reducers\CSharpNameReducer.Rewriter.cs (1)
223
return result.Parenthesize().WithAdditionalAnnotations(
Formatter
.Annotation);
TypeDeclarationSyntaxExtensions.cs (1)
104
return SyntaxFactory.Token(leadingTrivia, kind, trailingTrivia).WithAdditionalAnnotations(
Formatter
.Annotation);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (23)
CodeGeneration\AddAttributesTests.cs (1)
58
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);
815
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)
4481
var elasticOnlyFormatted =
Formatter
.Format(newRoot, SyntaxAnnotation.ElasticAnnotation, _workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).ToFullString();
Formatting\FormattingElasticTriviaTests.cs (7)
94
var newCompilation =
Formatter
.Format(compilation, workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
117
var newDecl = generator.AddAttributes(decl, generator.Attribute("Some")).WithAdditionalAnnotations(
Formatter
.Annotation);
134
var formatted =
Formatter
.Format(newRoot, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
137
var elasticOnlyFormatted =
Formatter
.Format(newRoot, SyntaxAnnotation.ElasticAnnotation, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
140
var annotationFormatted =
Formatter
.Format(newRoot,
Formatter
.Annotation, workspace.Services.SolutionServices, options, CancellationToken.None).ToFullString();
195
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)
4527
var newProperty =
Formatter
.Format(property, workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
8111
Formatter
.Format(block, new AdhocWorkspace().Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
9151
=>
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)
157
var formattedChanges =
Formatter
.GetFormattedTextChanges(newRoot, formattingSpans, document.Project.Solution.Services, formattingOptions, rules: null, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
Formatting\CoreFormatterTestsBase.cs (4)
207
var rules = formattingRuleProvider.CreateRule(documentSyntax, 0).Concat(
Formatter
.GetDefaultFormattingRules(document));
216
var newRootNode =
Formatter
.Format(root, spans, workspace.Services.SolutionServices, options, rules, CancellationToken.None);
229
var result =
Formatter
.GetFormattedTextChanges(root, spans, workspace.Services.SolutionServices, options, rules, CancellationToken.None);
291
var result =
Formatter
.Format(node, workspace.Services.SolutionServices, options, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
CodeGeneration\CodeGenerationTests.cs (5)
555
.WithAdditionalAnnotations(
Formatter
.Annotation);
574
.WithAdditionalAnnotations(
Formatter
.Annotation);
626
updatedDeclarationNode = updatedDeclarationNode.WithAdditionalAnnotations(
Formatter
.Annotation);
974
var actual =
Formatter
.FormatAsync(simplified,
Formatter
.Annotation, formattingOptions, CancellationToken.None).Result.GetSyntaxRootAsync().Result.ToFullString();
MetadataAsSource\MetadataAsSourceTests.cs (1)
1765
await
Formatter
.FormatAsync(document, CSharpSyntaxFormattingOptions.Default, CancellationToken.None);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Expansion\AbstractExpansionTest.vb (1)
49
document = Await
Formatter
.FormatAsync(document, cleanupOptions.FormattingOptions, CancellationToken.None)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (1)
Formatting\OmniSharpFormatter.cs (1)
18
=>
Formatter
.FormatAsync(document, spans, options.CleanupOptions.FormattingOptions, rules: null, cancellationToken);
Microsoft.CodeAnalysis.ExternalAccess.Razor (2)
RazorCSharpFormattingInteractionService.cs (2)
68
return
Formatter
.GetFormattedTextChanges(root, span, services.SolutionServices, GetFormattingOptions(indentationOptions), cancellationToken);
78
return
Formatter
.Format(root, services.SolutionServices, GetFormattingOptions(indentationOptions), cancellationToken: cancellationToken);
Microsoft.CodeAnalysis.Features (93)
AbstractAddDocCommentNodesCodeFixProvider.cs (1)
121
var newRoot = root.ReplaceNode(docCommentNode, newDocComment.WithAdditionalAnnotations(
Formatter
.Annotation));
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
93
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
104
.WithAdditionalAnnotations(
Formatter
.Annotation, annotation);
AbstractPopulateSwitchCodeFixProvider.cs (1)
199
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
38
switchNode, switchExpression).WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
39
switchNode, switchOperation).WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractRemoveUnusedValuesCodeFixProvider.cs (4)
407
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
422
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
657
editor.ReplaceNode(node, replacement.WithAdditionalAnnotations(
Formatter
.Annotation));
843
rootWithTrackedNodes =
Formatter
.Format(rootWithTrackedNodes, originalDeclStatementsToMoveOrRemove.Select(s => s.Span), provider, options, rules: null, cancellationToken);
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
97
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractUseConditionalExpressionCodeFixProvider.cs (2)
22
using Formatter = Microsoft.CodeAnalysis.Formatting.
Formatter
;
84
var formattedRoot =
Formatter
.Format(changedRoot, SpecializedFormattingAnnotation, provider, formattingOptions, rules, cancellationToken);
AbstractUseNullPropagationCodeFixProvider.cs (1)
190
.WithAdditionalAnnotations(
Formatter
.Annotation);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
98
.WithAdditionalAnnotations(
Formatter
.Annotation);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
65
.WithAdditionalAnnotations(
Formatter
.Annotation);
AddParameterService.cs (1)
125
.WithAdditionalAnnotations(
Formatter
.Annotation);
ChangeSignature\AbstractChangeSignatureService.cs (4)
406
var formattedRoot =
Formatter
.Format(
425
var formattedDoc = await
Formatter
.FormatAsync(reducedDoc, SyntaxAnnotation.ElasticAnnotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
519
newArguments.Add(argument.WithName(param.Name).WithAdditionalAnnotations(
Formatter
.Annotation));
542
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)
168
var textChanges =
Formatter
.GetFormattedTextChanges(
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (6)
416
import = import.WithAdditionalAnnotations(
Formatter
.Annotation);
628
.WithAdditionalAnnotations(
Formatter
.Annotation);
632
root =
Formatter
.Format(root,
Formatter
.Annotation, services, documentOptions.FormattingOptions, cancellationToken);
670
var formattedDocument = await
Formatter
.FormatAsync(documentWithAdditionalImports,
Formatter
.Annotation, documentOptions.FormattingOptions, cancellationToken)
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (5)
115
return await
Formatter
.FormatAsync(document, _annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
201
memberContainingDocument = await
Formatter
.FormatAsync(memberContainingDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
222
dismemberedDocument = await
Formatter
.FormatAsync(dismemberedDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (3)
145
var formattedDocumentWithImport = await
Formatter
.FormatAsync(documentWithImport,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
239
return syntaxGenerator.NamespaceImportDeclaration(namespaceName).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
240
.WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertAnonymousType\AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
130
return ConvertToTuple(anonCreation).WithAdditionalAnnotations(
Formatter
.Annotation);
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
101
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)
705
.WithAdditionalAnnotations(
Formatter
.Annotation);
EncapsulateField\AbstractEncapsulateFieldService.cs (7)
217
document = await
Formatter
.FormatAsync(document.WithSyntaxRoot(rewrittenFieldDeclaration),
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
225
var updatedLinkedDocument = await
Formatter
.FormatAsync(linkedDocument.WithSyntaxRoot(updatedLinkedRoot),
Formatter
.Annotation, linkedDocumentFormattingOptions, cancellationToken).ConfigureAwait(false);
251
documentWithProperty = await
Formatter
.FormatAsync(documentWithProperty,
Formatter
.Annotation, formattingOptions, cancellationToken).ConfigureAwait(false);
390
Formatter
.Annotation.AddAnnotationToSymbol(propertySymbol));
ExtractInterface\AbstractExtractInterfaceService.cs (3)
305
var formattedDocument = await
Formatter
.FormatAsync(
307
Formatter
.Annotation,
358
var unformattedTypeDeclaration = syntaxGenerator.AddInterfaceType(typeDeclaration, typeReference).WithAdditionalAnnotations(
Formatter
.Annotation);
ExtractMethod\ExtractMethodResult.cs (2)
101
Formatter
.Format(simplifiedRoot,
Formatter
.Annotation, services, cleanupOptions.FormattingOptions, FormattingRules, cancellationToken));
ExtractMethod\MethodExtractor.cs (1)
103
=> GetCustomFormattingRules(document).AddRange(
Formatter
.GetDefaultFormattingRules(document));
Formatting\FormattingRuleUtilities.cs (1)
26
return rules.AddRange(
Formatter
.GetDefaultFormattingRules(document.LanguageServices));
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (2)
32
rules.AddRange(
Formatter
.GetDefaultFormattingRules(document));
34
var formattedDocument = await
Formatter
.FormatAsync(
GenerateMember\GenerateVariable\AbstractGenerateVariableService.GenerateLocalCodeAction.cs (1)
72
localStatement = localStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
528
updatedExpression.WithAdditionalAnnotations(
Formatter
.Annotation), parameterName, insertionIndex, named);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (3)
145
newParent.WithAdditionalAnnotations(
Formatter
.Annotation)));
174
newParent.WithAdditionalAnnotations(
Formatter
.Annotation)));
183
usingStatement.WithAdditionalAnnotations(
Formatter
.Annotation)));
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
393
.WithAdditionalAnnotations(
Formatter
.Annotation);
IntroduceVariable\AbstractIntroduceVariableService.IntroduceVariableAllOccurrenceCodeAction.cs (2)
36
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, Options.FormattingOptions, cancellationToken).ConfigureAwait(false);
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (5)
511
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
536
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
563
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
586
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
611
return root.ReplaceNode(currentParent, updatedParent.WithAdditionalAnnotations(
Formatter
.Annotation));
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
72
var formattedDoc = await
Formatter
.FormatAsync(
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
287
var formattedDocument = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, formattingOptions, cancellationToken).ConfigureAwait(false);
PullMemberUp\MembersPuller.cs (1)
398
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)
112
var formattedDocument = await
Formatter
.FormatAsync(simplified, newCleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
129
return
Formatter
.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
111
var reformatSnippetNode = snippetExpressionNode.WithAdditionalAnnotations(findSnippetAnnotation, cursorAnnotation, Simplifier.Annotation, SymbolAnnotation.Create(consoleSymbol!),
Formatter
.Annotation);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (3)
174
document = await
Formatter
.FormatAsync(document, _findSnippetAnnotation, syntaxFormattingOptions, cancellationToken: cancellationToken).ConfigureAwait(false);
177
document = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, syntaxFormattingOptions, cancellationToken: cancellationToken).ConfigureAwait(false);
236
var reformatSnippetNode = snippetExpressionNode.WithAdditionalAnnotations(findSnippetAnnotation, cursorAnnotation, 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)));
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
288
return
Formatter
.Format(newRoot, SpecializedFormattingAnnotation, document.Project.Solution.Services, options, formattingRules, cancellationToken);
UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
92
return coalesceExpression.WithAdditionalAnnotations(
Formatter
.Annotation);
Wrapping\AbstractCodeActionComputer.cs (1)
168
var formattedDocument = await
Formatter
.FormatAsync(
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Features\CodeCleanup\AbstractCodeCleanupService.cs (1)
98
document = await
Formatter
.FormatAsync(document, formattingOptions, cancellationToken).ConfigureAwait(false);
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
45
var textChanges =
Formatter
.GetFormattedTextChanges(root, SpecializedCollections.SingletonEnumerable(formattingSpan), services, formattingOptions, rules: null, cancellationToken);
Handler\InlineCompletions\InlineCompletionsHandler.cs (1)
149
var formattingChanges =
Formatter
.GetFormattedTextChanges(root, spanToFormat, originalDocument.Project.Solution.Services, formattingOptions, cancellationToken: cancellationToken)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (10)
TypeBlockSyntaxExtensions.vb (3)
94
Return SyntaxFactory.EndClassStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
96
Return SyntaxFactory.EndInterfaceStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
98
Return SyntaxFactory.EndStructureStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicChangeToYieldCodeFixProvider.vb (1)
42
Dim yieldStatement = SyntaxFactory.YieldStatement(returnStatement.Expression).WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
100
.WithAdditionalAnnotations(
Formatter
.Annotation)
105
.WithAdditionalAnnotations(
Formatter
.Annotation)
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)
VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
108
Dim newCastExpression = Uncast(castExpression).WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicRemoveUnnecessaryImportsService.vb (1)
47
newRoot = newRoot.WithAdditionalAnnotations(
Formatter
.Annotation)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (11)
LineCommit\CommitFormatter.vb (6)
174
Return
Formatter
.GetDefaultFormattingRules(languageServices)
178
Return
Formatter
.GetDefaultFormattingRules(languageServices)
189
Return
Formatter
.GetDefaultFormattingRules(languageServices)
217
Return (New NoAnchorFormatterRule()).Concat(
Formatter
.GetDefaultFormattingRules(languageServices))
220
Return
Formatter
.GetDefaultFormattingRules(languageServices)
243
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)
177
newDocument =
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).WaitAndGetResult(cancellationToken)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (3)
Formatting\Indentation\SmartTokenFormatter_FormatTokenTests.vb (1)
193
Dim formattingRules = ImmutableArray.Create(Of AbstractFormattingRule)(New SpecialFormattingRule(indentStyle)).AddRange(
Formatter
.GetDefaultFormattingRules(document))
Formatting\VisualBasicFormatterTestBase.vb (2)
61
Dim rules = formattingRuleProvider.CreateRule(docSyntax, 0).Concat(
Formatter
.GetDefaultFormattingRules(document))
64
Dim changes =
Formatter
.GetFormattedTextChanges(
Microsoft.CodeAnalysis.VisualBasic.Features (38)
AddImport\VisualBasicAddImportFeatureService.vb (1)
303
newRoot = newRoot.WithAdditionalAnnotations(CaseCorrector.Annotation,
Formatter
.Annotation)
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
738
Return SpecializedCollections.SingletonEnumerable(Of AbstractFormattingRule)(New ChangeSignatureFormattingRule()).Concat(
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)
81
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)
51
root = root.ReplaceNode(fieldIdentifier, fieldIdentifier.WithIdentifier(newIdentifier).WithAdditionalAnnotations(annotation,
Formatter
.Annotation))
63
.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)
87
Formatter
.Annotation.AddAnnotationToSymbol(methodSymbol)))
107
Return container.CopyAnnotationsTo(callSiteGenerator.Generate()).WithAdditionalAnnotations(
Formatter
.Annotation)
FullyQualify\VisualBasicFullyQualifyService.vb (1)
67
WithAdditionalAnnotations(
Formatter
.Annotation, CaseCorrector.Annotation)
GenerateType\VisualBasicGenerateTypeService.vb (1)
676
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)
93
SyntaxFactory.EndFunctionStatement()).WithAdditionalAnnotations(
Formatter
.Annotation)
126
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation, localAnnotation)
156
Dim finalInnerMostBlock = oldInnerMostCommonBlock.ReplaceStatements(statements,
Formatter
.Annotation)
182
Dim newRoot = tree.ConvertSingleLineToMultiLineExecutableBlock(oldBlock, statements,
Formatter
.Annotation)
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceQueryLocal.vb (1)
30
expression)).WithAdditionalAnnotations(
Formatter
.Annotation)
MetadataAsSource\VisualBasicMetadataAsSourceService.vb (1)
67
Return _memberSeparationRule.Concat(
Formatter
.GetDefaultFormattingRules(document))
ReplaceMethodWithProperty\VisualBasicReplaceMethodWithPropertyService.vb (1)
128
Return newPropertyDeclaration.WithAdditionalAnnotations(
Formatter
.Annotation)
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
110
Return statement.WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicChangeToYieldCodeFixProvider.vb (1)
42
Dim yieldStatement = SyntaxFactory.YieldStatement(returnStatement.Expression).WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
100
.WithAdditionalAnnotations(
Formatter
.Annotation)
105
.WithAdditionalAnnotations(
Formatter
.Annotation)
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)
VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
108
Dim newCastExpression = Uncast(castExpression).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)
TypeBlockSyntaxExtensions.vb (3)
94
Return SyntaxFactory.EndClassStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
96
Return SyntaxFactory.EndInterfaceStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
98
Return SyntaxFactory.EndStructureStatement().WithAdditionalAnnotations(
Formatter
.Annotation)
VisualBasicRemoveUnnecessaryImportsService.vb (1)
47
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)
AbstractMoveDeclarationNearReferenceService.cs (4)
128
declarationStatement = declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation);
142
newNextStatement.WithAdditionalAnnotations(
Formatter
.Annotation).WithLeadingTrivia(
152
(current, generator) => current.WithAdditionalAnnotations(
Formatter
.Annotation).WithPrependedLeadingTrivia(
172
declarationStatement.WithAdditionalAnnotations(
Formatter
.Annotation));
AddParameterEditor.cs (4)
46
.WithAdditionalAnnotations(
Formatter
.Annotation);
73
.WithAdditionalAnnotations(
Formatter
.Annotation));
96
.WithAdditionalAnnotations(
Formatter
.Annotation));
117
.WithAdditionalAnnotations(
Formatter
.Annotation));
CodeActions\CodeAction.cs (4)
345
/// Formatting nodes annotated with <see cref="
Formatter
.Annotation"/>
374
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, options.FormattingOptions, cancellationToken).ConfigureAwait(false);
377
document = await
Formatter
.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, options.FormattingOptions, cancellationToken).ConfigureAwait(false);
CodeGenerationHelpers.cs (1)
47
=> node.WithAdditionalAnnotations(
Formatter
.Annotation, CodeGenerator.Annotation);
Editing\ImportAdderService.cs (1)
103
.WithAdditionalAnnotations(Simplifier.Annotation,
Formatter
.Annotation);
Formatting\AbstractFormattingService.cs (1)
21
return
Formatter
.FormatAsync(document, spans, syntaxFormattingOptions, rules: null, cancellationToken);
Rename\ConflictEngine\RenamedSpansTracker.cs (2)
166
document = await
Formatter
.FormatAsync(document,
Formatter
.Annotation, cleanupOptions.FormattingOptions, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Formatting\FormattingTestBase.cs (3)
75
var newRootNode =
Formatter
.Format(root, spans, services, options, rules: null, CancellationToken.None);
92
var result =
Formatter
.GetFormattedTextChanges(root, spans, services, options);
100
var idempotentResult =
Formatter
.GetFormattedTextChanges(resultRoot, adjustedSpans, services, options);
Microsoft.CodeAnalysis.Workspaces.UnitTests (11)
Editing\SyntaxEditorTests.cs (1)
34
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);
93
var formattedDocument = await
Formatter
.FormatAsync(document, spans: null, options, CancellationToken.None);
122
ValidateCSharpOptions((CSharpSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(csDocument, updatedOptions, CancellationToken.None)).Syntax!);
123
ValidateVisualBasicOptions((VisualBasicSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(vbDocument, updatedOptions, CancellationToken.None)).Syntax!);
132
ValidateCSharpOptions((CSharpSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(csDocumentWithUpdatedOptions, optionSet: null, CancellationToken.None)).Syntax!);
133
ValidateVisualBasicOptions((VisualBasicSyntaxFormattingOptions)(await
Formatter
.GetFormattingOptionsAsync(vbDocumentWithUpdatedOptions, optionSet: null, CancellationToken.None)).Syntax!);
134
ValidateOrganizeImportsOptions(await
Formatter
.GetOrganizeImportsOptionsAsync(csDocumentWithUpdatedOptions, CancellationToken.None));
135
ValidateOrganizeImportsOptions(await
Formatter
.GetOrganizeImportsOptionsAsync(vbDocumentWithUpdatedOptions, CancellationToken.None));
FormattingTests.cs (1)
87
var formattedRoot =
Formatter
.Format(tree.GetRoot(), workspace.Services.SolutionServices, options, CancellationToken.None);
SolutionTests\SolutionTests.cs (1)
2516
var newRoot = await
Formatter
.FormatAsync(document, CSharpSyntaxFormattingOptions.Default, CancellationToken.None).Result.GetSyntaxRootAsync();
Microsoft.VisualStudio.LanguageServices (6)
Implementation\AbstractEditorFactory.cs (1)
353
var formattedRoot =
Formatter
.Format(rootToFormat, workspace.Services.SolutionServices, cleanupOptions.FormattingOptions, cancellationToken);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
69
var rules = ruleFactory.CreateRule(documentSyntax, start).Concat(
Formatter
.GetDefaultFormattingRules(document.Project.Services));
Venus\ContainedDocument.cs (1)
810
var formattingRules = venusFormattingRules.Concat(
Formatter
.GetDefaultFormattingRules(document));
Venus\ContainedLanguageCodeSupport.cs (3)
231
var formattingRules = additionalFormattingRule.Concat(
Formatter
.GetDefaultFormattingRules(targetDocument));
233
newRoot =
Formatter
.Format(
235
Formatter
.Annotation,
Microsoft.VisualStudio.LanguageServices.CSharp (3)
Snippets\SnippetExpansionClient.cs (3)
128
var formattedDocument =
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, formattingOptions, cancellationToken).WaitAndGetResult(cancellationToken);
169
newUsings.Add(candidateUsing.WithAdditionalAnnotations(
Formatter
.Annotation).WithAppendedTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed));
Microsoft.VisualStudio.LanguageServices.Implementation (6)
CodeModel\AbstractCodeModelService.cs (2)
1038
var formattingRules =
Formatter
.GetDefaultFormattingRules(document);
1048
return await
Formatter
.FormatAsync(
CodeModel\FileCodeModel.cs (3)
352
var formatted = await
Formatter
.FormatAsync(result,
Formatter
.Annotation, formattingOptions, CancellationToken.None).ConfigureAwait(true);
353
formatted = await
Formatter
.FormatAsync(formatted, SyntaxAnnotation.ElasticAnnotation, formattingOptions, CancellationToken.None).ConfigureAwait(true);
Options\AbstractOptionPreviewViewModel.cs (1)
141
var formatted =
Formatter
.FormatAsync(document, formattingOptions, CancellationToken.None).WaitAndGetResult(CancellationToken.None);
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\SnippetExpansionClient.vb (3)
139
Dim formattedDocument =
Formatter
.FormatAsync(newDocument,
Formatter
.Annotation, formattingOptions, cancellationToken).WaitAndGetResult(cancellationToken)
204
importsToAdd.Add(filteredImportsStatement.WithAdditionalAnnotations(
Formatter
.Annotation) _