Share via


Formatter.FormatAsync Method

Definition

Overloads

FormatAsync(Document, OptionSet, CancellationToken)

Formats the whitespace in a document.

FormatAsync(Document, SyntaxAnnotation, OptionSet, CancellationToken)

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

FormatAsync(Document, TextSpan, OptionSet, CancellationToken)

Formats the whitespace in an area of a document corresponding to a text span.

FormatAsync(Document, IEnumerable<TextSpan>, OptionSet, CancellationToken)

Formats the whitespace in areas of a document corresponding to multiple non-overlapping spans.

FormatAsync(Document, 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 a document.

public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);
static member FormatAsync : Microsoft.CodeAnalysis.Document * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
Public Shared Function FormatAsync (document As Document, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document)

Parameters

document
Document

The document to format.

options
OptionSet

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

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted document.

Applies to

FormatAsync(Document, SyntaxAnnotation, 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 document corresponding to annotated nodes.

public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxAnnotation annotation, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);
static member FormatAsync : Microsoft.CodeAnalysis.Document * Microsoft.CodeAnalysis.SyntaxAnnotation * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
Public Shared Function FormatAsync (document As Document, annotation As SyntaxAnnotation, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document)

Parameters

document
Document

The document to format.

annotation
SyntaxAnnotation

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

options
OptionSet

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

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted document.

Applies to

FormatAsync(Document, TextSpan, 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 an area of a document corresponding to a text span.

public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);
static member FormatAsync : Microsoft.CodeAnalysis.Document * Microsoft.CodeAnalysis.Text.TextSpan * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
Public Shared Function FormatAsync (document As Document, span As TextSpan, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document)

Parameters

document
Document

The document to format.

span
TextSpan

The span of the document's text to format.

options
OptionSet

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

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted document.

Applies to

FormatAsync(Document, IEnumerable<TextSpan>, 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 document corresponding to multiple non-overlapping spans.

public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan> spans, Microsoft.CodeAnalysis.Options.OptionSet options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document> FormatAsync (Microsoft.CodeAnalysis.Document document, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Text.TextSpan>? spans, Microsoft.CodeAnalysis.Options.OptionSet? options = default, System.Threading.CancellationToken cancellationToken = default);
static member FormatAsync : Microsoft.CodeAnalysis.Document * seq<Microsoft.CodeAnalysis.Text.TextSpan> * Microsoft.CodeAnalysis.Options.OptionSet * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.CodeAnalysis.Document>
Public Shared Function FormatAsync (document As Document, spans As IEnumerable(Of TextSpan), Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document)

Parameters

document
Document

The document to format.

spans
IEnumerable<TextSpan>

The spans of the document's text to format.

options
OptionSet

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

cancellationToken
CancellationToken

An optional cancellation token.

Returns

The formatted document.

Applies to