Esempio n. 1
0
        public async Task <Document> FormatNewDocumentAsync(Document document, Document?hintDocument, CodeCleanupOptions options, CancellationToken cancellationToken)
        {
            var organizeImportsService = document.GetRequiredLanguageService <IOrganizeImportsService>();
            var organizedDocument      = await organizeImportsService.OrganizeImportsAsync(document, options.GetOrganizeImportsOptions(), cancellationToken).ConfigureAwait(false);

            return(await MisplacedUsingDirectivesCodeFixProvider.TransformDocumentIfRequiredAsync(
                       organizedDocument, options.SimplifierOptions, options.AddImportOptions.UsingDirectivePlacement, cancellationToken).ConfigureAwait(false));
        }
Esempio n. 2
0
        protected override async Task <Document> OrganizeUsingsCreatedFromTemplateAsync(
            Document document,
            CancellationToken cancellationToken
            )
        {
            var organizedDocument = await base.OrganizeUsingsCreatedFromTemplateAsync(
                document,
                cancellationToken
                )
                                    .ConfigureAwait(false);

            return(await MisplacedUsingDirectivesCodeFixProvider
                   .TransformDocumentIfRequiredAsync(organizedDocument, cancellationToken)
                   .ConfigureAwait(false));
        }
        public async Task <Document> FormatNewDocumentAsync(Document document, Document?hintDocument, SyntaxFormattingOptions options, CancellationToken cancellationToken)
        {
            var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken).ConfigureAwait(false);

            return(await MisplacedUsingDirectivesCodeFixProvider.TransformDocumentIfRequiredAsync(organizedDocument, cancellationToken).ConfigureAwait(false));
        }