Example #1
0
        private FixAllState(
            FixAllProvider fixAllProvider,
            Document document,
            Project project,
            CodeFixProvider codeFixProvider,
            FixAllScope scope,
            string codeActionEquivalenceKey,
            IEnumerable <string> diagnosticIds,
            FixAllContext.DiagnosticProvider fixAllDiagnosticProvider)
        {
            Contract.ThrowIfNull(project);
            if (diagnosticIds == null)
            {
                throw new ArgumentNullException(nameof(diagnosticIds));
            }

            if (diagnosticIds.Any(d => d == null))
            {
                throw new ArgumentException(WorkspacesResources.Supplied_diagnostic_cannot_be_null, nameof(diagnosticIds));
            }

            this.FixAllProvider           = fixAllProvider;
            this.Document                 = document;
            this.Project                  = project;
            this.CodeFixProvider          = codeFixProvider ?? throw new ArgumentNullException(nameof(codeFixProvider));
            this.Scope                    = scope;
            this.CodeActionEquivalenceKey = codeActionEquivalenceKey;
            this.DiagnosticIds            = ImmutableHashSet.CreateRange(diagnosticIds);
            this.DiagnosticProvider       = fixAllDiagnosticProvider ?? throw new ArgumentNullException(nameof(fixAllDiagnosticProvider));
        }
Example #2
0
 internal FixAllState(
     FixAllProvider?fixAllProvider,
     Project project,
     CodeFixProvider codeFixProvider,
     FixAllScope scope,
     string?codeActionEquivalenceKey,
     IEnumerable <string> diagnosticIds,
     FixAllContext.DiagnosticProvider fixAllDiagnosticProvider
     )
     : this(
         fixAllProvider,
         null,
         project,
         codeFixProvider,
         scope,
         codeActionEquivalenceKey,
         diagnosticIds,
         fixAllDiagnosticProvider
         )
 {
     if (project == null)
     {
         throw new ArgumentNullException(nameof(project));
     }
 }
Example #3
0
        internal FixAllState(
            FixAllProvider?fixAllProvider,
            TextSpan?diagnosticSpan,
            Document?document,
            Project project,
            CodeFixProvider codeFixProvider,
            FixAllScope scope,
            string?codeActionEquivalenceKey,
            IEnumerable <string> diagnosticIds,
            FixAllContext.DiagnosticProvider fixAllDiagnosticProvider,
            CodeActionOptionsProvider codeActionOptionsProvider)
        {
            Debug.Assert(document == null || document.Project == project);

            // We need the trigger diagnostic span for span based fix all scopes, i.e. FixAllScope.ContainingMember and FixAllScope.ContainingType
            Debug.Assert(diagnosticSpan.HasValue || scope is not FixAllScope.ContainingMember or FixAllScope.ContainingType);

            FixAllProvider            = fixAllProvider;
            DiagnosticSpan            = diagnosticSpan;
            Document                  = document;
            Project                   = project;
            CodeFixProvider           = codeFixProvider;
            Scope                     = scope;
            CodeActionEquivalenceKey  = codeActionEquivalenceKey;
            DiagnosticIds             = ImmutableHashSet.CreateRange(diagnosticIds);
            DiagnosticProvider        = fixAllDiagnosticProvider;
            CodeActionOptionsProvider = codeActionOptionsProvider;
        }
Example #4
0
        internal FixAllState(
            FixAllProvider?fixAllProvider,
            Document?document,
            Project project,
            CodeFixProvider codeFixProvider,
            FixAllScope scope,
            string?codeActionEquivalenceKey,
            IEnumerable <string> diagnosticIds,
            FixAllContext.DiagnosticProvider fixAllDiagnosticProvider,
            CodeActionOptionsProvider codeActionOptionsProvider)
        {
            Debug.Assert(document == null || document.Project == project);

            FixAllProvider            = fixAllProvider;
            Document                  = document;
            Project                   = project;
            CodeFixProvider           = codeFixProvider;
            Scope                     = scope;
            CodeActionEquivalenceKey  = codeActionEquivalenceKey;
            DiagnosticIds             = ImmutableHashSet.CreateRange(diagnosticIds);
            DiagnosticProvider        = fixAllDiagnosticProvider;
            CodeActionOptionsProvider = codeActionOptionsProvider;
        }