Formatter.Format Method

Definition

Overloads

Format(SyntaxNode, Workspace, OptionSet, CancellationToken)

Formats the whitespace of a syntax tree.

Format(SyntaxNode, SyntaxAnnotation, Workspace, OptionSet, CancellationToken)

Formats the whitespace in areas of a syntax tree corresponding to annotated nodes.

Format(SyntaxNode, TextSpan, Workspace, OptionSet, CancellationToken)

Formats the whitespace in areas of a syntax tree identified by a span.

Format(SyntaxNode, IEnumerable<TextSpan>, Workspace, OptionSet, CancellationToken)

Formats the whitespace in areas of a syntax tree identified by multiple non-overlapping spans.

Format(SyntaxNode, Workspace, OptionSet, CancellationToken)

Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs

Formats the whitespace of a syntax tree.

C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

node
SyntaxNode

The root node of a syntax tree to format.

workspace
Workspace

A workspace used to give the formatting context.

options
OptionSet

An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used.

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted tree's root node.

Applies to

Roslyn 4.13.0 ve diğer sürümler
Ürün Sürümler
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0

Format(SyntaxNode, SyntaxAnnotation, Workspace, OptionSet, CancellationToken)

Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs

Formats the whitespace in areas of a syntax tree corresponding to annotated nodes.

C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

node
SyntaxNode

The root node of a syntax tree to format.

annotation
SyntaxAnnotation

The annotation used to find nodes to identify spans to format.

workspace
Workspace

A workspace used to give the formatting context.

options
OptionSet

An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used.

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted tree's root node.

Applies to

Roslyn 4.13.0 ve diğer sürümler
Ürün Sürümler
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0

Format(SyntaxNode, TextSpan, Workspace, OptionSet, CancellationToken)

Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs

Formats the whitespace in areas of a syntax tree identified by a span.

C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

node
SyntaxNode

The root node of a syntax tree to format.

span
TextSpan

The span within the node's full span to format.

workspace
Workspace

A workspace used to give the formatting context.

options
OptionSet

An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used.

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted tree's root node.

Applies to

Roslyn 4.13.0 ve diğer sürümler
Ürün Sürümler
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0

Format(SyntaxNode, IEnumerable<TextSpan>, Workspace, OptionSet, CancellationToken)

Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs
Source:
Formatter.cs

Formats the whitespace in areas of a syntax tree identified by multiple non-overlapping spans.

C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
C#
public static Microsoft.CodeAnalysis.SyntaxNode Format(Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan>? spans, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

node
SyntaxNode

The root node of a syntax tree to format.

spans
IEnumerable<TextSpan>

The spans within the node's full span to format.

workspace
Workspace

A workspace used to give the formatting context.

options
OptionSet

An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used.

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted tree's root node.

Applies to

Roslyn 4.13.0 ve diğer sürümler
Ürün Sürümler
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0