Formatter.OrganizeImportsAsync(Document, CancellationToken) Method

Definition

Organizes the imports in the document.

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

Parameters

document
Document

The document to organize.

cancellationToken
CancellationToken

The cancellation token that the operation will observe.

Returns

The document with organized imports. If the language does not support organizing imports, or if no changes were made, this method returns document.

Applies to