private static async Task <IEnumerable <TextChange> > GetTextChangesAsync(
                IPragmaBasedCodeAction pragmaAction,
                Document currentDocument,
                bool includeStartTokenChange,
                bool includeEndTokenChange,
                CancellationToken cancellationToken)
            {
                var newDocument = await pragmaAction.GetChangedDocumentAsync(includeStartTokenChange, includeEndTokenChange, cancellationToken).ConfigureAwait(false);

                return(await newDocument.GetTextChangesAsync(currentDocument, cancellationToken).ConfigureAwait(false));
            }
Ejemplo n.º 2
0
            private static async Task <IEnumerable <TextChange> > GetChangedDocumentAsync(
                IPragmaBasedCodeAction pragmaAction,
                Document currentDocument,
                ImmutableArray <Diagnostic> diagnostics,
                Dictionary <Diagnostic, TextSpan> currentDiagnosticSpans,
                bool includeStartTokenChange,
                bool includeEndTokenChange,
                CancellationToken cancellationToken)
            {
                var newDocument = await pragmaAction.GetChangedDocumentAsync(includeStartTokenChange, includeEndTokenChange, cancellationToken).ConfigureAwait(false);

                // Update the diagnostics spans based on the text changes.
                var textChanges = await newDocument.GetTextChangesAsync(currentDocument, cancellationToken).ConfigureAwait(false);

                foreach (var textChange in textChanges)
                {
                    UpdateDiagnosticSpans(diagnostics, currentDiagnosticSpans, textChange);
                }

                return(textChanges);
            }
 private static async Task<IEnumerable<TextChange>> GetTextChangesAsync(
     IPragmaBasedCodeAction pragmaAction,
     Document currentDocument,
     ImmutableArray<Diagnostic> diagnostics,
     Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans,
     bool includeStartTokenChange,
     bool includeEndTokenChange,
     CancellationToken cancellationToken)
 {
     var newDocument = await pragmaAction.GetChangedDocumentAsync(includeStartTokenChange, includeEndTokenChange, cancellationToken).ConfigureAwait(false);                
     return await newDocument.GetTextChangesAsync(currentDocument, cancellationToken).ConfigureAwait(false);
 }
            private static async Task<IEnumerable<TextChange>> GetChangedDocumentAsync(
                IPragmaBasedCodeAction pragmaAction,
                Document currentDocument,
                ImmutableArray<Diagnostic> diagnostics,
                Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans,
                bool includeStartTokenChange,
                bool includeEndTokenChange,
                CancellationToken cancellationToken)
            {
                var newDocument = await pragmaAction.GetChangedDocumentAsync(includeStartTokenChange, includeEndTokenChange, cancellationToken).ConfigureAwait(false);
                
                // Update the diagnostics spans based on the text changes.
                var textChanges = await newDocument.GetTextChangesAsync(currentDocument, cancellationToken).ConfigureAwait(false);
                foreach (var textChange in textChanges)
                {
                    UpdateDiagnosticSpans(diagnostics, currentDiagnosticSpans, textChange);
                }

                return textChanges;
            }