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

Formats the whitespace of a syntax tree.

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);
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);
static member Format : Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.Workspace * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.SyntaxNode
Public Shared Function Format (node As SyntaxNode, workspace As Workspace, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode

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

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

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

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);
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);
static member Format : Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.SyntaxAnnotation * Microsoft.CodeAnalysis.Workspace * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.SyntaxNode
Public Shared Function Format (node As SyntaxNode, annotation As SyntaxAnnotation, workspace As Workspace, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode

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

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

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

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);
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);
static member Format : Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.Text.TextSpan * Microsoft.CodeAnalysis.Workspace * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.SyntaxNode
Public Shared Function Format (node As SyntaxNode, span As TextSpan, workspace As Workspace, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode

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

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

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

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);
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);
static member Format : Microsoft.CodeAnalysis.SyntaxNode * seq<Microsoft.CodeAnalysis.Text.TextSpan> * Microsoft.CodeAnalysis.Workspace * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.SyntaxNode
Public Shared Function Format (node As SyntaxNode, spans As IEnumerable(Of TextSpan), workspace As Workspace, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode

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