private void OnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     if (e.Option == _option)
     {
         this.RaiseChanged();
     }
 }
Esempio n. 2
0
 private void Options_OptionChanged(object sender, OptionChangedEventArgs e)
 {
     if (e.Option.Feature == nameof(ForceLowMemoryMode))
     {
         RefreshFromSettings();
     }
 }
 public override bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return e.Option.Feature == nameof(SimplificationOptions) ||
            e.Option.Feature == nameof(CodeStyleOptions) ||
            e.Option == ServiceFeatureOnOffOptions.ClosedFileDiagnostic ||
            e.Option == RuntimeOptions.FullSolutionAnalysis;
 }
Esempio n. 4
0
 private void OnGlobalOptionServiceOptionChanged(object?sender, OptionChangedEventArgs e)
 {
     _taskQueue.ScheduleTask(() =>
     {
         // Ensure we grab the event handlers inside the scheduled task to prevent a race of people unsubscribing
         // but getting the event later on the UI thread
         var eventHandlers = GetEventHandlers();
         foreach (var handler in eventHandlers)
         {
             handler(this, e);
         }
     }, "OptionsService.OnGlobalOptionServiceOptionChanged");
 }
Esempio n. 5
0
            private void OnGlobalOptionServiceOptionChanged(object sender, OptionChangedEventArgs e)
            {
                var eventHandlers = GetEventHandlers();

                if (eventHandlers.Length > 0)
                {
                    _taskQueue?.ScheduleTask(() =>
                    {
                        foreach (var handler in eventHandlers)
                        {
                            handler(this, e);
                        }
                    }, "OptionsService.SetOptions");
                }
            }
 public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return e.Option == TodoCommentOptions.TokenList;
 }
Esempio n. 7
0
 public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return false;
 }
 public override bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return e.Option.Feature == SimplificationOptions.PerLanguageFeatureName ||
            e.Option.Feature == SimplificationOptions.NonPerLanguageFeatureName ||
            e.Option == ServiceFeatureOnOffOptions.ClosedFileDiagnostic ||
            e.Option == InternalDiagnosticsOptions.UseDiagnosticEngineV2 ||
            Analyzer.NeedsReanalysisOnOptionChanged(sender, e);
 }
 public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return e.Option.Feature == SimplificationOptions.PerLanguageFeatureName ||
            e.Option.Feature == SimplificationOptions.NonPerLanguageFeatureName ||
            e.Option == ServiceFeatureOnOffOptions.ClosedFileDiagnostic;
 }
 public override bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     return e.Option.Feature == nameof(SimplificationOptions) ||
            e.Option == ServiceFeatureOnOffOptions.ClosedFileDiagnostic ||
            e.Option == RuntimeOptions.FullSolutionAnalysis ||
            e.Option == InternalDiagnosticsOptions.UseDiagnosticEngineV2 ||
            Analyzer.NeedsReanalysisOnOptionChanged(sender, e);
 }
Esempio n. 11
0
 private void ReanalyzeOnOptionChange(object sender, OptionChangedEventArgs e)
 {
     // otherwise, let each analyzer decide what they want on option change
     ISet<DocumentId> set = null;
     foreach (var analyzer in _documentAndProjectWorkerProcessor.Analyzers)
     {
         if (analyzer.NeedsReanalysisOnOptionChanged(sender, e))
         {
             set = set ?? _registration.CurrentSolution.Projects.SelectMany(p => p.DocumentIds).ToSet();
             this.Reanalyze(analyzer, set);
         }
     }
 }
Esempio n. 12
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);
            }
 public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
 {
     // TODO: Is this correct?
     return false;
 }
Esempio n. 14
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);
            }
        private void OnOptionChanged(object sender, OptionChangedEventArgs e)
        {
            Contract.ThrowIfFalse(_errorList is IErrorList2);

            if (e.Option == RuntimeOptions.FullSolutionAnalysis || e.Option == ServiceFeatureOnOffOptions.ClosedFileDiagnostic)
            {
                var analysisDisabled = !(bool)e.Value;
                if (analysisDisabled)
                {
                    ((IErrorList2)_errorList).AnalysisToggleState = false;
                }
            }
        }
Esempio n. 16
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);
            }