Esempio n. 1
0
                public IncrementalAnalyzerProcessor(
                    IAsynchronousOperationListener listener,
                    IEnumerable <Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders,
                    Registration registration,
                    int highBackOffTimeSpanInMs, int normalBackOffTimeSpanInMs, int lowBackOffTimeSpanInMs, CancellationToken shutdownToken)
                {
                    _logAggregator = new LogAggregator();

                    _listener     = listener;
                    _registration = registration;
                    _cacheService = registration.GetService <IProjectCacheService>();

                    _lazyDiagnosticAnalyzerService = new Lazy <IDiagnosticAnalyzerService>(() => GetDiagnosticAnalyzerService(analyzerProviders));

                    var analyzersGetter = new AnalyzersGetter(analyzerProviders);

                    // create analyzers lazily.
                    var lazyActiveFileAnalyzers = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: true));
                    var lazyAllAnalyzers        = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false));

                    // event and worker queues
                    _documentTracker = _registration.GetService <IDocumentTrackingService>();

                    var globalNotificationService = _registration.GetService <IGlobalOperationNotificationService>();

                    _highPriorityProcessor   = new HighPriorityProcessor(listener, this, lazyActiveFileAnalyzers, highBackOffTimeSpanInMs, shutdownToken);
                    _normalPriorityProcessor = new NormalPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, normalBackOffTimeSpanInMs, shutdownToken);
                    _lowPriorityProcessor    = new LowPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, lowBackOffTimeSpanInMs, shutdownToken);
                }
Esempio n. 2
0
                public IncrementalAnalyzerProcessor(
                    IAsynchronousOperationListener listener,
                    IEnumerable <Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders,
                    bool initializeLazily,
                    Registration registration,
                    TimeSpan highBackOffTimeSpan,
                    TimeSpan normalBackOffTimeSpan,
                    TimeSpan lowBackOffTimeSpan,
                    CancellationToken shutdownToken)
                {
                    _listener     = listener;
                    _registration = registration;
                    _cacheService = registration.Workspace.Services.GetService <IProjectCacheService>();

                    _lazyDiagnosticAnalyzerService = new Lazy <IDiagnosticAnalyzerService?>(() => GetDiagnosticAnalyzerService(analyzerProviders));

                    var analyzersGetter = new AnalyzersGetter(analyzerProviders);

                    // create analyzers lazily.
                    var lazyActiveFileAnalyzers = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: true));
                    var lazyAllAnalyzers        = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false));

                    if (!initializeLazily)
                    {
                        // realize all analyzer right away
                        _ = lazyActiveFileAnalyzers.Value;
                        _ = lazyAllAnalyzers.Value;
                    }

                    // event and worker queues
                    _documentTracker = _registration.Workspace.Services.GetRequiredService <IDocumentTrackingService>();

                    var globalNotificationService = _registration.Workspace.Services.GetRequiredService <IGlobalOperationNotificationService>();

                    _highPriorityProcessor   = new HighPriorityProcessor(listener, this, lazyActiveFileAnalyzers, highBackOffTimeSpan, shutdownToken);
                    _normalPriorityProcessor = new NormalPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, normalBackOffTimeSpan, shutdownToken);
                    _lowPriorityProcessor    = new LowPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, lowBackOffTimeSpan, shutdownToken);
                }
                public IncrementalAnalyzerProcessor(
                    IAsynchronousOperationListener listener,
                    int correlationId, Workspace workspace,
                    IEnumerable <Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders,
                    int highBackOffTimeSpanInMs, int normalBackOffTimeSpanInMs, int lowBackOffTimeSpanInMs, CancellationToken shutdownToken)
                {
                    this.logAggregator = new LogAggregator();
                    this.listener      = listener;

                    var lazyActiveFileAnalyzers = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetActiveFileIncrementalAnalyzers(correlationId, workspace, analyzerProviders));
                    var lazyAllAnalyzers        = new Lazy <ImmutableArray <IIncrementalAnalyzer> >(() => GetIncrementalAnalyzers(correlationId, workspace, analyzerProviders));

                    // event and worker queues
                    this.correlationId = correlationId;
                    this.workspace     = workspace;

                    this.documentTracker = workspace.Services.GetService <IDocumentTrackingService>();

                    var globalNotificationService = workspace.Services.GetService <IGlobalOperationNotificationService>();

                    this.highPriorityProcessor   = new HighPriorityProcessor(listener, this, lazyActiveFileAnalyzers, highBackOffTimeSpanInMs, shutdownToken);
                    this.normalPriorityProcessor = new NormalPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, normalBackOffTimeSpanInMs, shutdownToken);
                    this.lowPriorityProcessor    = new LowPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, lowBackOffTimeSpanInMs, shutdownToken);
                }
 internal TestAccessor(LowPriorityProcessor lowPriorityProcessor)
 {
     _lowPriorityProcessor = lowPriorityProcessor;
 }