protected override CompilationOptions ComputeCompilationOptionsWithHostValues(CompilationOptions compilationOptions, IRuleSetFile ruleSetFileOpt)
            {
                IDictionary <string, ReportDiagnostic> ruleSetSpecificDiagnosticOptions = null;

                // Get options from the ruleset file, if any, first. That way project-specific
                // options can override them.
                ReportDiagnostic?ruleSetGeneralDiagnosticOption = null;

                // TODO: merge this core logic back down to the base of OptionsProcessor, since this should be the same for all languages. The CompilationOptions
                // would then already contain the right information, and could be updated accordingly by the language-specific logic.
                if (ruleSetFileOpt != null)
                {
                    ruleSetGeneralDiagnosticOption   = ruleSetFileOpt.GetGeneralDiagnosticOption();
                    ruleSetSpecificDiagnosticOptions = new Dictionary <string, ReportDiagnostic>(ruleSetFileOpt.GetSpecificDiagnosticOptions());
                }
                else
                {
                    ruleSetSpecificDiagnosticOptions = new Dictionary <string, ReportDiagnostic>();
                }

                ReportDiagnostic generalDiagnosticOption;
                var warningsAreErrors = GetNullableBooleanOption(CompilerOptions.OPTID_WARNINGSAREERRORS);

                if (warningsAreErrors.HasValue)
                {
                    generalDiagnosticOption = warningsAreErrors.Value ? ReportDiagnostic.Error : ReportDiagnostic.Default;
                }
                else if (ruleSetGeneralDiagnosticOption.HasValue)
                {
                    generalDiagnosticOption = ruleSetGeneralDiagnosticOption.Value;
                }
                else
                {
                    generalDiagnosticOption = ReportDiagnostic.Default;
                }

                // Start with the rule set options
                var diagnosticOptions = new Dictionary <string, ReportDiagnostic>(ruleSetSpecificDiagnosticOptions);

                // Update the specific options based on the general settings
                if (warningsAreErrors.HasValue && warningsAreErrors.Value == true)
                {
                    foreach (var pair in ruleSetSpecificDiagnosticOptions)
                    {
                        if (pair.Value == ReportDiagnostic.Warn)
                        {
                            diagnosticOptions[pair.Key] = ReportDiagnostic.Error;
                        }
                    }
                }

                // Update the specific options based on the specific settings
                foreach (var diagnosticID in ParseWarningCodes(CompilerOptions.OPTID_WARNASERRORLIST))
                {
                    diagnosticOptions[diagnosticID] = ReportDiagnostic.Error;
                }

                foreach (var diagnosticID in ParseWarningCodes(CompilerOptions.OPTID_WARNNOTASERRORLIST))
                {
                    if (ruleSetSpecificDiagnosticOptions.TryGetValue(diagnosticID, out var ruleSetOption))
                    {
                        diagnosticOptions[diagnosticID] = ruleSetOption;
                    }
                    else
                    {
                        diagnosticOptions[diagnosticID] = ReportDiagnostic.Default;
                    }
                }

                foreach (var diagnosticID in ParseWarningCodes(CompilerOptions.OPTID_NOWARNLIST))
                {
                    diagnosticOptions[diagnosticID] = ReportDiagnostic.Suppress;
                }

                if (!Enum.TryParse(GetStringOption(CompilerOptions.OPTID_PLATFORM, ""), ignoreCase: true, result: out Platform platform))
                {
                    platform = Platform.AnyCpu;
                }

                if (!int.TryParse(GetStringOption(CompilerOptions.OPTID_WARNINGLEVEL, defaultValue: ""), out var warningLevel))
                {
                    warningLevel = 4;
                }

                // TODO: appConfigPath: GetFilePathOption(CompilerOptions.OPTID_FUSIONCONFIG), bug #869604

                return(((CSharpCompilationOptions)compilationOptions).WithAllowUnsafe(GetBooleanOption(CompilerOptions.OPTID_UNSAFE))
                       .WithOverflowChecks(GetBooleanOption(CompilerOptions.OPTID_CHECKED))
                       .WithCryptoKeyContainer(GetStringOption(CompilerOptions.OPTID_KEYNAME, defaultValue: null))
                       .WithCryptoKeyFile(GetFilePathRelativeOption(CompilerOptions.OPTID_KEYFILE))
                       .WithDelaySign(GetNullableBooleanOption(CompilerOptions.OPTID_DELAYSIGN))
                       .WithGeneralDiagnosticOption(generalDiagnosticOption)
                       .WithMainTypeName(_mainTypeName)
                       .WithModuleName(GetStringOption(CompilerOptions.OPTID_MODULEASSEMBLY, defaultValue: null))
                       .WithOptimizationLevel(GetBooleanOption(CompilerOptions.OPTID_OPTIMIZATIONS) ? OptimizationLevel.Release : OptimizationLevel.Debug)
                       .WithOutputKind(_outputKind)
                       .WithPlatform(platform)
                       .WithSpecificDiagnosticOptions(diagnosticOptions)
                       .WithWarningLevel(warningLevel));
            }
        private void UpdateSeverityMenuItemsChecked()
        {
            _setSeverityErrorMenuItem.Checked   = false;
            _setSeverityWarningMenuItem.Checked = false;
            _setSeverityInfoMenuItem.Checked    = false;
            _setSeverityHiddenMenuItem.Checked  = false;
            _setSeverityNoneMenuItem.Checked    = false;

            var workspace = TryGetWorkspace() as VisualStudioWorkspaceImpl;

            if (workspace == null)
            {
                return;
            }

            HashSet <ReportDiagnostic> selectedItemSeverities = new HashSet <ReportDiagnostic>();

            var groups = _tracker.SelectedDiagnosticItems.GroupBy(item => item.AnalyzerItem.AnalyzersFolder.ProjectId);

            foreach (var group in groups)
            {
                var          project = (AbstractProject)workspace.GetHostProject(group.Key);
                IRuleSetFile ruleSet = project.RuleSetFile;

                if (ruleSet != null)
                {
                    var specificOptions = ruleSet.GetSpecificDiagnosticOptions();

                    foreach (var diagnosticItem in group)
                    {
                        ReportDiagnostic ruleSetSeverity;
                        if (specificOptions.TryGetValue(diagnosticItem.Descriptor.Id, out ruleSetSeverity) &&
                            ruleSetSeverity != ReportDiagnostic.Default)
                        {
                            selectedItemSeverities.Add(ruleSetSeverity);
                        }
                    }
                }
            }

            if (selectedItemSeverities.Count != 1)
            {
                return;
            }

            switch (selectedItemSeverities.Single())
            {
            case ReportDiagnostic.Default:
                break;

            case ReportDiagnostic.Error:
                _setSeverityErrorMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Warn:
                _setSeverityWarningMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Info:
                _setSeverityInfoMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Hidden:
                _setSeverityHiddenMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Suppress:
                _setSeverityNoneMenuItem.Checked = true;
                break;

            default:
                break;
            }
        }
        private void UpdateSeverityMenuItemsChecked()
        {
            _setSeverityDefaultMenuItem.Checked = false;
            _setSeverityErrorMenuItem.Checked   = false;
            _setSeverityWarningMenuItem.Checked = false;
            _setSeverityInfoMenuItem.Checked    = false;
            _setSeverityHiddenMenuItem.Checked  = false;
            _setSeverityNoneMenuItem.Checked    = false;

            var workspace = TryGetWorkspace() as VisualStudioWorkspaceImpl;

            if (workspace == null)
            {
                return;
            }

            HashSet <ReportDiagnostic> selectedItemSeverities = new HashSet <ReportDiagnostic>();

            var groups = _tracker.SelectedDiagnosticItems.GroupBy(item => item.ProjectId);

            foreach (var group in groups)
            {
                // TODO: move this off GetHostProject (https://devdiv.visualstudio.com/DevDiv/_workitems/edit/698029)
#pragma warning disable CS0618 // Type or member is obsolete
                var project = (AbstractProject)workspace.GetHostProject(group.Key);
#pragma warning restore CS0618 // Type or member is obsolete
                IRuleSetFile ruleSet = project.RuleSetFile?.Target;

                if (ruleSet != null)
                {
                    var specificOptions = ruleSet.GetSpecificDiagnosticOptions();

                    foreach (var diagnosticItem in group)
                    {
                        if (specificOptions.TryGetValue(diagnosticItem.Descriptor.Id, out var ruleSetSeverity))
                        {
                            selectedItemSeverities.Add(ruleSetSeverity);
                        }
                        else
                        {
                            // The rule has no setting.
                            selectedItemSeverities.Add(ReportDiagnostic.Default);
                        }
                    }
                }
            }

            if (selectedItemSeverities.Count != 1)
            {
                return;
            }

            switch (selectedItemSeverities.Single())
            {
            case ReportDiagnostic.Default:
                _setSeverityDefaultMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Error:
                _setSeverityErrorMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Warn:
                _setSeverityWarningMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Info:
                _setSeverityInfoMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Hidden:
                _setSeverityHiddenMenuItem.Checked = true;
                break;

            case ReportDiagnostic.Suppress:
                _setSeverityNoneMenuItem.Checked = true;
                break;

            default:
                break;
            }
        }