public async Task<AnalysisData> GetDocumentBodyAnalysisDataAsync(
                StateSet stateSet, VersionArgument versions, DiagnosticAnalyzerDriver analyzerDriver,
                SyntaxNode root, SyntaxNode member, int memberId, bool supportsSemanticInSpan, MemberRangeMap.MemberRanges ranges)
            {
                try
                {
                    var document = analyzerDriver.Document;
                    var cancellationToken = analyzerDriver.CancellationToken;

                    var state = stateSet.GetState(StateType.Document);
                    var existingData = await state.TryGetExistingDataAsync(document, cancellationToken).ConfigureAwait(false);

                    ImmutableArray<DiagnosticData> diagnosticData;
                    if (supportsSemanticInSpan && CanUseRange(memberId, ranges.Ranges) && CanUseDocumentState(existingData, ranges.TextVersion, versions.DataVersion))
                    {
                        var memberDxData = await GetSemanticDiagnosticsAsync(analyzerDriver, stateSet.Analyzer).ConfigureAwait(false);

                        diagnosticData = _owner.UpdateDocumentDiagnostics(existingData, ranges.Ranges, memberDxData.AsImmutableOrEmpty(), root.SyntaxTree, member, memberId);
                        ValidateMemberDiagnostics(stateSet.Analyzer, document, root, diagnosticData);
                    }
                    else
                    {
                        // if we can't re-use existing document state, only option we have is updating whole document state here.
                        var dx = await GetSemanticDiagnosticsAsync(analyzerDriver, stateSet.Analyzer).ConfigureAwait(false);
                        diagnosticData = dx.AsImmutableOrEmpty();
                    }
                    return new AnalysisData(versions.TextVersion, versions.DataVersion, GetExistingItems(existingData), diagnosticData);
                }
                catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
                {
                    throw ExceptionUtilities.Unreachable;
                }
            }
Beispiel #2
0
        public DiagnosticIncrementalAnalyzer(DiagnosticAnalyzerService owner, int correlationId, Workspace workspace, AnalyzerManager analyzerManager)
        {
            _owner             = owner;
            _correlationId     = correlationId;
            _memberRangeMap    = new MemberRangeMap();
            _analyzersAndState = new DiagnosticAnalyzersAndStates(this, workspace, analyzerManager);
            _executor          = new AnalyzerExecutor(this);

            _diagnosticLogAggregator = new DiagnosticLogAggregator(_owner);
        }
        public DiagnosticIncrementalAnalyzer(DiagnosticAnalyzerService owner, int correlationId, Workspace workspace, AnalyzerManager analyzerManager)
        {
            _owner = owner;
            _correlationId = correlationId;
            _memberRangeMap = new MemberRangeMap();
            _analyzersAndState = new DiagnosticAnalyzersAndStates(this, workspace, analyzerManager);
            _executor = new AnalyzerExecutor(this);

            _diagnosticLogAggregator = new DiagnosticLogAggregator(_owner);
        }
Beispiel #4
0
 public DiagnosticIncrementalAnalyzer(
     DiagnosticAnalyzerService owner,
     int correlationId,
     Workspace workspace,
     HostAnalyzerManager analyzerManager,
     AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource)
     : base(owner, workspace, analyzerManager, hostDiagnosticUpdateSource)
 {
     _correlationId  = correlationId;
     _memberRangeMap = new MemberRangeMap();
     _executor       = new AnalyzerExecutor(this);
     _eventQueue     = new SimpleTaskQueue(TaskScheduler.Default);
     _stateManager   = new StateManager(analyzerManager);
     _stateManager.ProjectAnalyzerReferenceChanged += OnProjectAnalyzerReferenceChanged;
 }
        public DiagnosticIncrementalAnalyzer(
            DiagnosticAnalyzerService owner,
            int correlationId,
            Workspace workspace,
            HostAnalyzerManager analyzerManager,
            AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource)
            : base(owner, workspace, analyzerManager, hostDiagnosticUpdateSource)
        {
            _correlationId = correlationId;
            _memberRangeMap = new MemberRangeMap();
            _executor = new AnalyzerExecutor(this);

            _stateManager = new StateManager(analyzerManager);
            _stateManager.ProjectAnalyzerReferenceChanged += OnProjectAnalyzerReferenceChanged;
        }
 public DiagnosticIncrementalAnalyzer(
     DiagnosticAnalyzerService owner,
     int correlationId,
     Workspace workspace,
     HostAnalyzerManager analyzerManager,
     AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource)
     : base(owner, workspace, analyzerManager, hostDiagnosticUpdateSource)
 {
     _correlationId = correlationId;
     _memberRangeMap = new MemberRangeMap();
     _executor = new AnalyzerExecutor(this);
     _eventQueue = new SimpleTaskQueue(TaskScheduler.Default);
     _stateManager = new StateManager(analyzerManager);
     _stateManager.ProjectAnalyzerReferenceChanged += OnProjectAnalyzerReferenceChanged;
     _solutionCrawlerAnalysisState = new SolutionCrawlerAnalysisState(analyzerManager);
 }
Beispiel #7
0
        public DiagnosticIncrementalAnalyzer(
            DiagnosticAnalyzerService owner,
            int correlationId,
            Workspace workspace,
            WorkspaceAnalyzerManager workspaceAnalyzerManager,
            AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource)
            : base(workspace, hostDiagnosticUpdateSource)
        {
            _owner             = owner;
            _correlationId     = correlationId;
            _memberRangeMap    = new MemberRangeMap();
            _analyzersAndState = new DiagnosticAnalyzersAndStates(this, workspace, workspaceAnalyzerManager);
            _executor          = new AnalyzerExecutor(this);

            _diagnosticLogAggregator = new DiagnosticLogAggregator(_owner);
        }