示例#1
0
            private void OnOptionChanged(object?sender, OptionChangedEventArgs e)
            {
                // if solution crawler got turned off or on.
                if (e.Option == InternalSolutionCrawlerOptions.SolutionCrawler)
                {
                    Contract.ThrowIfNull(e.Value);

                    var value = (bool)e.Value;
                    if (value)
                    {
                        _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   += OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   += OnDocumentClosed;
                    }
                    else
                    {
                        _registration.Workspace.WorkspaceChanged -= OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   -= OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   -= OnDocumentClosed;
                    }

                    SolutionCrawlerLogger.LogOptionChanged(CorrelationId, value);
                    return;
                }

                if (!_optionService.GetOption(InternalSolutionCrawlerOptions.SolutionCrawler))
                {
                    // Bail out if solution crawler is disabled.
                    return;
                }

                ReanalyzeOnOptionChange(sender, e);
            }
示例#2
0
            private void OnOptionChanged(object sender, OptionChangedEventArgs e)
            {
                // if solution crawler got turned off or on.
                if (e.Option == InternalSolutionCrawlerOptions.SolutionCrawler)
                {
                    var value = (bool)e.Value;
                    if (value)
                    {
                        _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   += OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   += OnDocumentClosed;
                    }
                    else
                    {
                        _registration.Workspace.WorkspaceChanged -= OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   -= OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   -= OnDocumentClosed;
                    }

                    SolutionCrawlerLogger.LogOptionChanged(CorrelationId, value);
                    return;
                }

                // Changing the UseV2Engine option is a no-op as we have a single engine now.
                if (e.Option == Diagnostics.InternalDiagnosticsOptions.UseDiagnosticEngineV2)
                {
                    _documentAndProjectWorkerProcessor.ChangeDiagnosticsEngine((bool)e.Value);
                }

                ReanalyzeOnOptionChange(sender, e);
            }
示例#3
0
            private void OnOptionChanged(object sender, OptionChangedEventArgs e)
            {
                // if solution crawler got turned off or on.
                if (e.Option == InternalSolutionCrawlerOptions.SolutionCrawler)
                {
                    var value = (bool)e.Value;
                    if (value)
                    {
                        _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   += OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   += OnDocumentClosed;
                    }
                    else
                    {
                        _registration.Workspace.WorkspaceChanged -= OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   -= OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   -= OnDocumentClosed;
                    }

                    SolutionCrawlerLogger.LogOptionChanged(CorrelationId, value);
                    return;
                }

                ReanalyzeOnOptionChange(sender, e);
            }
示例#4
0
            private void OnOptionChanged(object sender, OptionChangedEventArgs e)
            {
                // if solution crawler got turned off or on.
                if (e.Option == InternalSolutionCrawlerOptions.SolutionCrawler)
                {
                    var value = (bool)e.Value;
                    if (value)
                    {
                        _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   += OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   += OnDocumentClosed;
                    }
                    else
                    {
                        _registration.Workspace.WorkspaceChanged -= OnWorkspaceChanged;
                        _registration.Workspace.DocumentOpened   -= OnDocumentOpened;
                        _registration.Workspace.DocumentClosed   -= OnDocumentClosed;
                    }

                    SolutionCrawlerLogger.LogOptionChanged(CorrelationId, value);
                    return;
                }

                // TODO: remove this once prototype is done
                //       it is here just because it was convenient to add per workspace option change monitoring
                //       for incremental analyzer
                if (e.Option == Diagnostics.InternalDiagnosticsOptions.UseDiagnosticEngineV2)
                {
                    _documentAndProjectWorkerProcessor.ChangeDiagnosticsEngine((bool)e.Value);
                }

                ReanalyzeOnOptionChange(sender, e);
            }