From d597a005dc467e9a1d5a163e31f0cbeb8497e2d4 Mon Sep 17 00:00:00 2001 From: Srivatsn Narayanan Date: Fri, 22 Apr 2016 17:09:30 -0700 Subject: [PATCH] Revert "turn off csharp full solution analysis." --- .../Diagnostics/DiagnosticServiceTests.vb | 4 -- .../Options/ServiceFeatureOnOffOptions.cs | 4 +- .../AbstractSettingStoreOptionSerializer.cs | 4 +- ...AbstractSettingsManagerOptionSerializer.cs | 2 +- .../Core/Portable/Options/IOption2.cs | 9 ---- .../Core/Portable/Options/OptionKey.cs | 2 - .../Core/Portable/Options/OptionService.cs | 2 +- .../Core/Portable/Options/OptionSet.cs | 2 +- .../Core/Portable/Options/Option`1.cs | 23 ++++++--- .../Portable/Options/PerLanguageOption.cs | 50 +------------------ .../Core/Portable/Workspaces.csproj | 1 - 11 files changed, 24 insertions(+), 79 deletions(-) delete mode 100644 src/Workspaces/Core/Portable/Options/IOption2.cs diff --git a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb index 52b94238e9d..55f3a531d47 100644 --- a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb @@ -10,7 +10,6 @@ Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Options -Imports Microsoft.CodeAnalysis.Shared.Options Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.UnitTests.Diagnostics @@ -1916,9 +1915,6 @@ class MyClass Using workspace = TestWorkspace.CreateWorkspace(test) - ' set csharp closed diagnostic option on - workspace.Options = workspace.Options.WithChangedOption(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, LanguageNames.CSharp, True) - Dim project = workspace.CurrentSolution.Projects.Single() ' Add analyzer diff --git a/src/Features/Core/Portable/Shared/Options/ServiceFeatureOnOffOptions.cs b/src/Features/Core/Portable/Shared/Options/ServiceFeatureOnOffOptions.cs index 2611ec98541..4d747c45e99 100644 --- a/src/Features/Core/Portable/Shared/Options/ServiceFeatureOnOffOptions.cs +++ b/src/Features/Core/Portable/Shared/Options/ServiceFeatureOnOffOptions.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Immutable; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.Shared.Options @@ -14,7 +13,6 @@ internal static class ServiceFeatureOnOffOptions /// this option doesn't mean we will show all diagnostics that belong to opened files when turned off, /// rather it means we will only show diagnostics that are cheap to calculate for small scope such as opened files. /// - public static readonly PerLanguageOption ClosedFileDiagnostic = new PerLanguageOption( - OptionName, "Closed File Diagnostic", defaultValue: true, perLanguageDefaults: ImmutableDictionary.Empty.Add(LanguageNames.CSharp, false)); + public static readonly PerLanguageOption ClosedFileDiagnostic = new PerLanguageOption(OptionName, "Closed File Diagnostic", defaultValue: true); } } diff --git a/src/VisualStudio/Core/Impl/Options/AbstractSettingStoreOptionSerializer.cs b/src/VisualStudio/Core/Impl/Options/AbstractSettingStoreOptionSerializer.cs index dc87ba018ab..bcd282f6fe8 100644 --- a/src/VisualStudio/Core/Impl/Options/AbstractSettingStoreOptionSerializer.cs +++ b/src/VisualStudio/Core/Impl/Options/AbstractSettingStoreOptionSerializer.cs @@ -34,7 +34,7 @@ public virtual bool TryPersist(OptionKey optionKey, object value) return TryPersist(optionKey, value, (r, k, o, v) => r.SetValue(k, (bool)v ? 1 : 0, RegistryValueKind.DWord)); } - protected bool TryFetch(OptionKey optionKey, Func valueGetter, out object value) + protected bool TryFetch(OptionKey optionKey, Func valueGetter, out object value) { if (this.RegistryKey == null) { @@ -58,7 +58,7 @@ protected bool TryFetch(OptionKey optionKey, Func public IOption Option { get; } public string Language { get; } - internal object DefaultValue => ((IOption2)Option).GetDefaultValue(Language); - public OptionKey(IOption option, string language = null) { if (option == null) diff --git a/src/Workspaces/Core/Portable/Options/OptionService.cs b/src/Workspaces/Core/Portable/Options/OptionService.cs index c6a30107eff..de73f3c956e 100644 --- a/src/Workspaces/Core/Portable/Options/OptionService.cs +++ b/src/Workspaces/Core/Portable/Options/OptionService.cs @@ -81,7 +81,7 @@ private object LoadOptionFromSerializerOrGetDefault(OptionKey optionKey) // Just use the default. We will still cache this so we aren't trying to deserialize // over and over. - return optionKey.DefaultValue; + return optionKey.Option.DefaultValue; } } diff --git a/src/Workspaces/Core/Portable/Options/OptionSet.cs b/src/Workspaces/Core/Portable/Options/OptionSet.cs index 2c9acd7f0f9..eac193bb2ec 100644 --- a/src/Workspaces/Core/Portable/Options/OptionSet.cs +++ b/src/Workspaces/Core/Portable/Options/OptionSet.cs @@ -51,7 +51,7 @@ public object GetOption(OptionKey optionKey) if (!_values.TryGetValue(optionKey, out value)) { - value = _service != null ? _service.GetOption(optionKey) : optionKey.DefaultValue; + value = _service != null ? _service.GetOption(optionKey) : optionKey.Option.DefaultValue; _values = _values.Add(optionKey, value); } diff --git a/src/Workspaces/Core/Portable/Options/Option`1.cs b/src/Workspaces/Core/Portable/Options/Option`1.cs index 521c7414f3f..5c8bea66b81 100644 --- a/src/Workspaces/Core/Portable/Options/Option`1.cs +++ b/src/Workspaces/Core/Portable/Options/Option`1.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.Options /// /// An global option. An instance of this class can be used to access an option value from an OptionSet. /// - public class Option : IOption2, IOption + public class Option : IOption { /// /// Feature this option is associated with. @@ -22,7 +22,10 @@ public class Option : IOption2, IOption /// /// The type of the option value. /// - public Type Type => typeof(T); + public Type Type + { + get { return typeof(T); } + } /// /// The default value of the option. @@ -46,13 +49,19 @@ public Option(string feature, string name, T defaultValue = default(T)) this.DefaultValue = defaultValue; } - Type IOption.Type => typeof(T); - object IOption.DefaultValue => this.DefaultValue; - bool IOption.IsPerLanguage => false; + Type IOption.Type + { + get { return typeof(T); } + } + + object IOption.DefaultValue + { + get { return this.DefaultValue; } + } - object IOption2.GetDefaultValue(string language) + bool IOption.IsPerLanguage { - return this.DefaultValue; + get { return false; } } public override string ToString() diff --git a/src/Workspaces/Core/Portable/Options/PerLanguageOption.cs b/src/Workspaces/Core/Portable/Options/PerLanguageOption.cs index ae04592fb49..23398e14ad9 100644 --- a/src/Workspaces/Core/Portable/Options/PerLanguageOption.cs +++ b/src/Workspaces/Core/Portable/Options/PerLanguageOption.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; -using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Options { @@ -10,13 +8,8 @@ namespace Microsoft.CodeAnalysis.Options /// An option that can be specified once per language. /// /// - public class PerLanguageOption : IOption2, IOption + public class PerLanguageOption : IOption { - /// - /// Save per language defaults - /// - private readonly IImmutableDictionary _perLanguageDefaults; - /// /// Feature this option is associated with. /// @@ -40,32 +33,7 @@ public Type Type /// public T DefaultValue { get; } - /// - /// The default option value of specific language - /// - internal T GetDefaultValue(string language) - { - if (_perLanguageDefaults.Count == 0) - { - return DefaultValue; - } - - T languageSpecificDefault; - if (!_perLanguageDefaults.TryGetValue(language, out languageSpecificDefault)) - { - return DefaultValue; - } - - return languageSpecificDefault; - } - - public PerLanguageOption(string feature, string name, T defaultValue) : - this(feature, name, defaultValue, ImmutableDictionary.Empty) - { - } - - internal PerLanguageOption( - string feature, string name, T defaultValue, IDictionary perLanguageDefaults) + public PerLanguageOption(string feature, string name, T defaultValue) { if (string.IsNullOrWhiteSpace(feature)) { @@ -77,18 +45,9 @@ internal T GetDefaultValue(string language) throw new ArgumentException(nameof(name)); } - if (perLanguageDefaults == null) - { - throw new ArgumentNullException(nameof(perLanguageDefaults)); - } - this.Feature = feature; this.Name = name; this.DefaultValue = defaultValue; - - this._perLanguageDefaults = - (perLanguageDefaults as IImmutableDictionary) ?? - ImmutableDictionary.CreateRange(perLanguageDefaults); } Type IOption.Type @@ -106,11 +65,6 @@ bool IOption.IsPerLanguage get { return true; } } - object IOption2.GetDefaultValue(string language) - { - return this.GetDefaultValue(language); - } - public override string ToString() { return string.Format("{0} - {1}", this.Feature, this.Name); diff --git a/src/Workspaces/Core/Portable/Workspaces.csproj b/src/Workspaces/Core/Portable/Workspaces.csproj index 2dcb9fbdcee..6e59591f1bb 100644 --- a/src/Workspaces/Core/Portable/Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Workspaces.csproj @@ -387,7 +387,6 @@ - -- GitLab