internal async Task <ImmutableArray <CodeActionOperation> > GetOperationsAsync(CancellationToken cancellationToken = default(CancellationToken)) { Diagnostic diagnostic = this.DiagnosticsToFix.First(); Document document = this.Solution.GetDocument(diagnostic.Location.SourceTree); var diagnosticsProvider = TesterDiagnosticProvider.Create(this.DiagnosticsToFix); var context = new FixAllContext(document, this.CodeFixProvider, FixAllScope.Solution, this.CodeFixEquivalenceKey, this.DiagnosticsToFix.Select(x => x.Id), diagnosticsProvider, cancellationToken); CodeAction action = await this.FixAllProvider.GetFixAsync(context).ConfigureAwait(false); return(await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false)); }
internal async Task <ImmutableArray <CodeActionOperation> > GetOperationsAsync(CancellationToken cancellationToken) { Diagnostic diagnostic = this.DocumentDiagnosticsToFix.Values.SelectMany(i => i.Values).Concat(this.ProjectDiagnosticsToFix.Values).First().First(); Document document = this.Solution.GetDocument(diagnostic.Location.SourceTree); HashSet <string> diagnosticIds = new HashSet <string>(this.DocumentDiagnosticsToFix.Values.SelectMany(i => i.Values).Concat(this.ProjectDiagnosticsToFix.Values).SelectMany(i => i.Select(j => j.Id))); var diagnosticsProvider = new TesterDiagnosticProvider(this.DocumentDiagnosticsToFix, this.ProjectDiagnosticsToFix); var context = new FixAllContext(document, this.CodeFixProvider, FixAllScope.Solution, this.CodeFixEquivalenceKey, diagnosticIds, diagnosticsProvider, cancellationToken); CodeAction action = await this.FixAllProvider.GetFixAsync(context).ConfigureAwait(false); return(await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false)); }
internal async Task<ImmutableArray<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken) { Diagnostic diagnostic = this.DocumentDiagnosticsToFix.Values.SelectMany(i => i.Values).Concat(this.ProjectDiagnosticsToFix.Values).First().First(); Document document = this.Solution.GetDocument(diagnostic.Location.SourceTree); HashSet<string> diagnosticIds = new HashSet<string>(this.DocumentDiagnosticsToFix.Values.SelectMany(i => i.Values).Concat(this.ProjectDiagnosticsToFix.Values).SelectMany(i => i.Select(j => j.Id))); var diagnosticsProvider = new TesterDiagnosticProvider(this.DocumentDiagnosticsToFix, this.ProjectDiagnosticsToFix); var context = new FixAllContext(document, this.CodeFixProvider, FixAllScope.Solution, this.CodeFixEquivalenceKey, diagnosticIds, diagnosticsProvider, cancellationToken); CodeAction action = await this.FixAllProvider.GetFixAsync(context).ConfigureAwait(false); return await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false); }