private static async Task <Document> FixOneAsync( CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken ) { var options = await context.Document .GetOptionsAsync(cancellationToken) .ConfigureAwait(false); var tree = await context.Document .GetSyntaxTreeAsync(cancellationToken) .ConfigureAwait(false); var formattedTree = await FormattingCodeFixHelper .FixOneAsync( tree, context.Document.Project.Solution.Workspace, options, diagnostic, cancellationToken ) .ConfigureAwait(false); return(context.Document.WithSyntaxRoot( await formattedTree.GetRootAsync(cancellationToken).ConfigureAwait(false) )); }
private async Task <Document> FixOneAsync(CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken) { var options = await GetOptionsAsync(context.Document, cancellationToken).ConfigureAwait(false); var tree = await context.Document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); var updatedTree = await FormattingCodeFixHelper.FixOneAsync(tree, SyntaxFormattingService, options, diagnostic, cancellationToken).ConfigureAwait(false); return(context.Document.WithText(await updatedTree.GetTextAsync(cancellationToken).ConfigureAwait(false))); }
private async Task <Document> FixOneAsync(CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken) { var options = await context.Document.GetCodeFixOptionsAsync(context.GetOptionsProvider(), cancellationToken).ConfigureAwait(false); var formattingOptions = options.GetFormattingOptions(SyntaxFormatting); var tree = await context.Document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); var updatedTree = await FormattingCodeFixHelper.FixOneAsync(tree, SyntaxFormatting, formattingOptions, diagnostic, cancellationToken).ConfigureAwait(false); return(context.Document.WithText(await updatedTree.GetTextAsync(cancellationToken).ConfigureAwait(false))); }
private async Task <Document> FixOneAsync(CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken) { var options = await GetOptionsAsync(context.Document, cancellationToken).ConfigureAwait(false); return(await FormattingCodeFixHelper.FixOneAsync(context.Document, options, diagnostic, cancellationToken).ConfigureAwait(false)); }