internal static FixAllCodeActionContext Create(
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable<Diagnostic> originalFixDiagnostics,
     Func<Document, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getDocumentDiagnosticsAsync,
     Func<Project, bool, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getProjectDiagnosticsAsync,
     CancellationToken cancellationToken)
 {
     var diagnosticIds = GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics).ToImmutableHashSet();
     var diagnosticProvider = new FixAllDiagnosticProvider(diagnosticIds, getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync);
     return new FixAllCodeActionContext(project, fixAllProviderInfo, originalFixProvider, originalFixDiagnostics, diagnosticIds, diagnosticProvider, cancellationToken);
 }
 private FixAllCodeActionContext(
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable<Diagnostic> originalFixDiagnostics,
     ImmutableHashSet<string> diagnosticIds,
     FixAllDiagnosticProvider diagnosticProvider,
     CancellationToken cancellationToken)
     : base(project, originalFixProvider, FixAllScope.Project, null, diagnosticIds, diagnosticProvider, cancellationToken)
 {
     _fixAllProviderInfo = fixAllProviderInfo;
     _originalFixDiagnostics = originalFixDiagnostics;
     _diagnosticProvider = diagnosticProvider;
 }
Example #3
0
 private FixAllCodeActionContext(
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable <Diagnostic> originalFixDiagnostics,
     ImmutableHashSet <string> diagnosticIds,
     FixAllDiagnosticProvider diagnosticProvider,
     CancellationToken cancellationToken)
     : base(project, originalFixProvider, FixAllScope.Project, null, diagnosticIds, diagnosticProvider, cancellationToken)
 {
     _fixAllProviderInfo     = fixAllProviderInfo;
     _originalFixDiagnostics = originalFixDiagnostics;
     _diagnosticProvider     = diagnosticProvider;
 }
Example #4
0
        internal static FixAllCodeActionContext Create(
            Project project,
            FixAllProviderInfo fixAllProviderInfo,
            CodeFixProvider originalFixProvider,
            IEnumerable <Diagnostic> originalFixDiagnostics,
            Func <Document, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getDocumentDiagnosticsAsync,
            Func <Project, bool, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getProjectDiagnosticsAsync,
            CancellationToken cancellationToken)
        {
            var diagnosticIds      = GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics).ToImmutableHashSet();
            var diagnosticProvider = new FixAllDiagnosticProvider(diagnosticIds, getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync);

            return(new FixAllCodeActionContext(project, fixAllProviderInfo, originalFixProvider, originalFixDiagnostics, diagnosticIds, diagnosticProvider, cancellationToken));
        }
 internal FixAllCodeActionContext(
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable <Diagnostic> originalFixDiagnostics,
     Func <Document, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getDocumentDiagnosticsAsync,
     Func <Project, bool, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getProjectDiagnosticsAsync,
     CancellationToken cancellationToken)
     : base(project, originalFixProvider, FixAllScope.Project,
            null, GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics),
            getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync, cancellationToken)
 {
     _fixAllProviderInfo          = fixAllProviderInfo;
     _originalFixDiagnostics      = originalFixDiagnostics;
     _getDocumentDiagnosticsAsync = getDocumentDiagnosticsAsync;
     _getProjectDiagnosticsAsync  = getProjectDiagnosticsAsync;
 }
 internal FixAllCodeActionContext(
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable<Diagnostic> originalFixDiagnostics,
     Func<Document, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getDocumentDiagnosticsAsync,
     Func<Project, bool, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getProjectDiagnosticsAsync,
     CancellationToken cancellationToken)
     : base(project, originalFixProvider, FixAllScope.Project,
           null, GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics),
           getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync, cancellationToken)
 {
     _fixAllProviderInfo = fixAllProviderInfo;
     _originalFixDiagnostics = originalFixDiagnostics;
     _getDocumentDiagnosticsAsync = getDocumentDiagnosticsAsync;
     _getProjectDiagnosticsAsync = getProjectDiagnosticsAsync;
 }
Example #7
0
        internal static FixAllState Create(
            FixAllProvider fixAllProvider,
            Project project,
            FixAllProviderInfo fixAllProviderInfo,
            CodeFixProvider originalFixProvider,
            IEnumerable <Diagnostic> originalFixDiagnostics,
            Func <Document, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getDocumentDiagnosticsAsync,
            Func <Project, bool, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getProjectDiagnosticsAsync)
        {
            var diagnosticIds      = GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics).ToImmutableHashSet();
            var diagnosticProvider = new FixAllDiagnosticProvider(diagnosticIds, getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync);

            return(new FixAllState(
                       fixAllProvider: fixAllProvider,
                       project: project,
                       codeFixProvider: originalFixProvider,
                       scope: FixAllScope.Project,
                       codeActionEquivalenceKey: null, diagnosticIds: diagnosticIds,
                       fixAllDiagnosticProvider: diagnosticProvider));
        }
Example #8
0
        internal FixAllState CreateFixAllState(
            FixAllProvider fixAllProvider,
            Document document,
            FixAllProviderInfo fixAllProviderInfo,
            CodeFixProvider originalFixProvider,
            IEnumerable <Diagnostic> originalFixDiagnostics,
            Func <Document, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getDocumentDiagnosticsAsync,
            Func <Project, bool, ImmutableHashSet <string>, CancellationToken, Task <IEnumerable <Diagnostic> > > getProjectDiagnosticsAsync)
        {
            var diagnosticIds = originalFixDiagnostics.Where(fixAllProviderInfo.CanBeFixed)
                                .Select(d => d.Id)
                                .ToImmutableHashSet();
            var diagnosticProvider = new FixAllDiagnosticProvider(this, diagnosticIds);

            return(new FixAllState(
                       fixAllProvider: fixAllProvider,
                       document: document,
                       codeFixProvider: originalFixProvider,
                       scope: FixAllScope.Document,
                       codeActionEquivalenceKey: null,
                       diagnosticIds: diagnosticIds,
                       fixAllDiagnosticProvider: diagnosticProvider));
        }
Example #9
0
 private static IEnumerable <string> GetFixAllDiagnosticIds(FixAllProviderInfo fixAllProviderInfo, IEnumerable <Diagnostic> originalFixDiagnostics)
 {
     return(originalFixDiagnostics
            .Where(fixAllProviderInfo.CanBeFixed)
            .Select(d => d.Id));
 }
 private static IEnumerable <string> GetFixAllDiagnosticIds(FixAllProviderInfo fixAllProviderInfo, IEnumerable <Diagnostic> originalFixDiagnostics)
 {
     return(originalFixDiagnostics
            .Where(d => fixAllProviderInfo.SupportedDiagnosticIds.Contains(d.Id))
            .Select(d => d.Id));
 }
Example #11
0
 private static IEnumerable<string> GetFixAllDiagnosticIds(FixAllProviderInfo fixAllProviderInfo, IEnumerable<Diagnostic> originalFixDiagnostics)
 {
     return originalFixDiagnostics
         .Where(fixAllProviderInfo.CanBeFixed)
         .Select(d => d.Id);
 }
Example #12
0
 internal static FixAllState Create(
     FixAllProvider fixAllProvider,
     Project project,
     FixAllProviderInfo fixAllProviderInfo,
     CodeFixProvider originalFixProvider,
     IEnumerable<Diagnostic> originalFixDiagnostics,
     Func<Document, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getDocumentDiagnosticsAsync,
     Func<Project, bool, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getProjectDiagnosticsAsync)
 {
     var diagnosticIds = GetFixAllDiagnosticIds(fixAllProviderInfo, originalFixDiagnostics).ToImmutableHashSet();
     var diagnosticProvider = new FixAllDiagnosticProvider(diagnosticIds, getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync);
     return new FixAllState(
         fixAllProvider: fixAllProvider,
         project: project,
         codeFixProvider: originalFixProvider,
         scope: FixAllScope.Project,
         codeActionEquivalenceKey: null, diagnosticIds: diagnosticIds,
         fixAllDiagnosticProvider: diagnosticProvider);
 }
 private static IEnumerable<string> GetFixAllDiagnosticIds(FixAllProviderInfo fixAllProviderInfo, IEnumerable<Diagnostic> originalFixDiagnostics)
 {
     return originalFixDiagnostics
         .Where(d => fixAllProviderInfo.SupportedDiagnosticIds.Contains(d.Id))
         .Select(d => d.Id);
 }