Skip to content

Commit

Permalink
Move bunch of options in Workspaces and Features layers to use the ne…
Browse files Browse the repository at this point in the history
…w option types
  • Loading branch information
mavasani committed Mar 10, 2020
1 parent 70b4089 commit 3ba9025
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace Microsoft.CodeAnalysis.CSharp.Completion
internal static class CSharpCompletionOptions
{
[Obsolete("This option is superceded by CompletionOptions.EnterKeyBehavior")]
public static readonly Option<bool> AddNewLineOnEnterAfterFullyTypedWord = new Option<bool>(nameof(CSharpCompletionOptions), nameof(AddNewLineOnEnterAfterFullyTypedWord), defaultValue: false);
public static readonly Option2<bool> AddNewLineOnEnterAfterFullyTypedWord = new Option2<bool>(nameof(CSharpCompletionOptions), nameof(AddNewLineOnEnterAfterFullyTypedWord), defaultValue: false);

[Obsolete("This option is superceded by CompletionOptions.SnippetsBehavior")]
public static readonly Option<bool> IncludeSnippets = new Option<bool>(nameof(CSharpCompletionOptions), nameof(IncludeSnippets), defaultValue: true);
public static readonly Option2<bool> IncludeSnippets = new Option2<bool>(nameof(CSharpCompletionOptions), nameof(IncludeSnippets), defaultValue: true);
}
}
36 changes: 18 additions & 18 deletions src/Features/Core/Portable/Completion/CompletionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@ namespace Microsoft.CodeAnalysis.Completion
internal static class CompletionOptions
{
// This is serialized by the Visual Studio-specific LanguageSettingsPersister
public static readonly PerLanguageOption<bool> HideAdvancedMembers = new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(HideAdvancedMembers), defaultValue: false);
public static readonly PerLanguageOption2<bool> HideAdvancedMembers = new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(HideAdvancedMembers), defaultValue: false);

// This is serialized by the Visual Studio-specific LanguageSettingsPersister
public static readonly PerLanguageOption<bool> TriggerOnTyping = new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(TriggerOnTyping), defaultValue: true);
public static readonly PerLanguageOption2<bool> TriggerOnTyping = new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(TriggerOnTyping), defaultValue: true);

public static readonly PerLanguageOption<bool> TriggerOnTypingLetters = new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(TriggerOnTypingLetters), defaultValue: true,
public static readonly PerLanguageOption2<bool> TriggerOnTypingLetters = new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(TriggerOnTypingLetters), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.TriggerOnTypingLetters"));
public static readonly PerLanguageOption<bool?> TriggerOnDeletion = new PerLanguageOption<bool?>(nameof(CompletionOptions), nameof(TriggerOnDeletion), defaultValue: null,
public static readonly PerLanguageOption2<bool?> TriggerOnDeletion = new PerLanguageOption2<bool?>(nameof(CompletionOptions), nameof(TriggerOnDeletion), defaultValue: null,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.TriggerOnDeletion"));

public static readonly PerLanguageOption<EnterKeyRule> EnterKeyBehavior =
new PerLanguageOption<EnterKeyRule>(nameof(CompletionOptions), nameof(EnterKeyBehavior), defaultValue: EnterKeyRule.Default,
public static readonly PerLanguageOption2<EnterKeyRule> EnterKeyBehavior =
new PerLanguageOption2<EnterKeyRule>(nameof(CompletionOptions), nameof(EnterKeyBehavior), defaultValue: EnterKeyRule.Default,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.EnterKeyBehavior"));

public static readonly PerLanguageOption<SnippetsRule> SnippetsBehavior =
new PerLanguageOption<SnippetsRule>(nameof(CompletionOptions), nameof(SnippetsBehavior), defaultValue: SnippetsRule.Default,
public static readonly PerLanguageOption2<SnippetsRule> SnippetsBehavior =
new PerLanguageOption2<SnippetsRule>(nameof(CompletionOptions), nameof(SnippetsBehavior), defaultValue: SnippetsRule.Default,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.SnippetsBehavior"));

// Dev15 options
public static readonly PerLanguageOption<bool> ShowCompletionItemFilters = new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(ShowCompletionItemFilters), defaultValue: true,
public static readonly PerLanguageOption2<bool> ShowCompletionItemFilters = new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(ShowCompletionItemFilters), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ShowCompletionItemFilters"));

public static readonly PerLanguageOption<bool> HighlightMatchingPortionsOfCompletionListItems = new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(HighlightMatchingPortionsOfCompletionListItems), defaultValue: true,
public static readonly PerLanguageOption2<bool> HighlightMatchingPortionsOfCompletionListItems = new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(HighlightMatchingPortionsOfCompletionListItems), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.HighlightMatchingPortionsOfCompletionListItems"));

public static readonly PerLanguageOption<bool> BlockForCompletionItems = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> BlockForCompletionItems = new PerLanguageOption2<bool>(
nameof(CompletionOptions), nameof(BlockForCompletionItems), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{BlockForCompletionItems}"));

public static readonly PerLanguageOption<bool> ShowNameSuggestions =
new PerLanguageOption<bool>(nameof(CompletionOptions), nameof(ShowNameSuggestions), defaultValue: true,
public static readonly PerLanguageOption2<bool> ShowNameSuggestions =
new PerLanguageOption2<bool>(nameof(CompletionOptions), nameof(ShowNameSuggestions), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ShowNameSuggestions"));

//Dev16 options

// Use tri-value so the default state can be used to turn on the feature with experimentation service.
public static readonly PerLanguageOption<bool?> ShowItemsFromUnimportedNamespaces =
new PerLanguageOption<bool?>(nameof(CompletionOptions), nameof(ShowItemsFromUnimportedNamespaces), defaultValue: null,
public static readonly PerLanguageOption2<bool?> ShowItemsFromUnimportedNamespaces =
new PerLanguageOption2<bool?>(nameof(CompletionOptions), nameof(ShowItemsFromUnimportedNamespaces), defaultValue: null,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ShowItemsFromUnimportedNamespaces"));

public static IEnumerable<PerLanguageOption<bool>> GetDev15CompletionOptions()
public static IEnumerable<PerLanguageOption2<bool>> GetDev15CompletionOptions()
{
yield return ShowCompletionItemFilters;
yield return HighlightMatchingPortionsOfCompletionListItems;
Expand All @@ -61,7 +61,7 @@ public static IEnumerable<PerLanguageOption<bool>> GetDev15CompletionOptions()

internal static class CompletionControllerOptions
{
public static readonly Option<bool> FilterOutOfScopeLocals = new Option<bool>(nameof(CompletionControllerOptions), nameof(FilterOutOfScopeLocals), defaultValue: true);
public static readonly Option<bool> ShowXmlDocCommentCompletion = new Option<bool>(nameof(CompletionControllerOptions), nameof(ShowXmlDocCommentCompletion), defaultValue: true);
public static readonly Option2<bool> FilterOutOfScopeLocals = new Option2<bool>(nameof(CompletionControllerOptions), nameof(FilterOutOfScopeLocals), defaultValue: true);
public static readonly Option2<bool> ShowXmlDocCommentCompletion = new Option2<bool>(nameof(CompletionControllerOptions), nameof(ShowXmlDocCommentCompletion), defaultValue: true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal static class CompletionServiceOptions
/// <summary>
/// Indicates if the completion is trigger by toggle the expander.
/// </summary>
public static readonly Option<bool> IsExpandedCompletion
= new Option<bool>(nameof(CompletionServiceOptions), nameof(IsExpandedCompletion), defaultValue: false);
public static readonly Option2<bool> IsExpandedCompletion
= new Option2<bool>(nameof(CompletionServiceOptions), nameof(IsExpandedCompletion), defaultValue: false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ internal static class FxCopAnalyzersInstallOptions
private const string LocalRegistryPath = @"Roslyn\Internal\FxCopAnalyzers\";
private const string LocalRegistryPath_CodeAnalysis2017 = @"Roslyn\Internal\Analyzers\AB\Vsix\";

public static readonly Option<long> LastDateTimeUsedSuggestionAction = new Option<long>(nameof(FxCopAnalyzersInstallOptions),
public static readonly Option2<long> LastDateTimeUsedSuggestionAction = new Option2<long>(nameof(FxCopAnalyzersInstallOptions),
nameof(LastDateTimeUsedSuggestionAction), defaultValue: DateTime.MinValue.ToBinary(),
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(LastDateTimeUsedSuggestionAction)));

public static readonly Option<int> UsedSuggestedActionCount = new Option<int>(nameof(FxCopAnalyzersInstallOptions), nameof(UsedSuggestedActionCount),
public static readonly Option2<int> UsedSuggestedActionCount = new Option2<int>(nameof(FxCopAnalyzersInstallOptions), nameof(UsedSuggestedActionCount),
defaultValue: 0, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(UsedSuggestedActionCount)));

public static readonly Option<bool> NeverShowAgain_CodeAnalysis2017 = new Option<bool>(@"AnalyzerABTestOptions", @"NeverShowAgain",
public static readonly Option2<bool> NeverShowAgain_CodeAnalysis2017 = new Option2<bool>(@"AnalyzerABTestOptions", @"NeverShowAgain",
defaultValue: false, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath_CodeAnalysis2017 + @"NeverShowAgain"));

public static readonly Option<bool> NeverShowAgain = new Option<bool>(nameof(FxCopAnalyzersInstallOptions), nameof(NeverShowAgain),
public static readonly Option2<bool> NeverShowAgain = new Option2<bool>(nameof(FxCopAnalyzersInstallOptions), nameof(NeverShowAgain),
defaultValue: false, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath_CodeAnalysis2017 + nameof(NeverShowAgain)));

public static readonly Option<bool> HasMetCandidacyRequirements = new Option<bool>(nameof(FxCopAnalyzersInstallOptions), nameof(HasMetCandidacyRequirements),
public static readonly Option2<bool> HasMetCandidacyRequirements = new Option2<bool>(nameof(FxCopAnalyzersInstallOptions), nameof(HasMetCandidacyRequirements),
defaultValue: false, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(HasMetCandidacyRequirements)));

public static readonly Option<long> LastDateTimeInfoBarShown = new Option<long>(nameof(FxCopAnalyzersInstallOptions), nameof(LastDateTimeInfoBarShown),
public static readonly Option2<long> LastDateTimeInfoBarShown = new Option2<long>(nameof(FxCopAnalyzersInstallOptions), nameof(LastDateTimeInfoBarShown),
defaultValue: DateTime.MinValue.ToBinary(),
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(LastDateTimeInfoBarShown)));

public static readonly Option<bool> VsixInstalled = new Option<bool>(nameof(FxCopAnalyzersInstallOptions),
public static readonly Option2<bool> VsixInstalled = new Option2<bool>(nameof(FxCopAnalyzersInstallOptions),
nameof(VsixInstalled), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(VsixInstalled)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace Microsoft.CodeAnalysis.ExtractMethod
{
internal static class ExtractMethodOptions
{
public static readonly PerLanguageOption<bool> AllowBestEffort = new PerLanguageOption<bool>(nameof(ExtractMethodOptions), nameof(AllowBestEffort), defaultValue: true,
public static readonly PerLanguageOption2<bool> AllowBestEffort = new PerLanguageOption2<bool>(nameof(ExtractMethodOptions), nameof(AllowBestEffort), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Allow Best Effort"));

public static readonly PerLanguageOption<bool> DontPutOutOrRefOnStruct = new PerLanguageOption<bool>(nameof(ExtractMethodOptions), nameof(DontPutOutOrRefOnStruct), defaultValue: true,
public static readonly PerLanguageOption2<bool> DontPutOutOrRefOnStruct = new PerLanguageOption2<bool>(nameof(ExtractMethodOptions), nameof(DontPutOutOrRefOnStruct), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Don't Put Out Or Ref On Strcut")); // NOTE: the spelling error is what we've shipped and thus should not change

public static readonly PerLanguageOption<bool> AllowMovingDeclaration = new PerLanguageOption<bool>(nameof(ExtractMethodOptions), nameof(AllowMovingDeclaration), defaultValue: false,
public static readonly PerLanguageOption2<bool> AllowMovingDeclaration = new PerLanguageOption2<bool>(nameof(ExtractMethodOptions), nameof(AllowMovingDeclaration), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Allow Moving Declaration"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.GenerateConstructorFromMembers
{
internal static class GenerateConstructorFromMembersOptions
{
public static readonly PerLanguageOption<bool> AddNullChecks = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> AddNullChecks = new PerLanguageOption2<bool>(
nameof(GenerateConstructorFromMembersOptions),
nameof(AddNullChecks), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers
{
internal static class GenerateEqualsAndGetHashCodeFromMembersOptions
{
public static readonly PerLanguageOption<bool> GenerateOperators = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> GenerateOperators = new PerLanguageOption2<bool>(
nameof(GenerateEqualsAndGetHashCodeFromMembersOptions),
nameof(GenerateOperators), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation(
$"TextEditor.%LANGUAGE%.Specific.{nameof(GenerateEqualsAndGetHashCodeFromMembersOptions)}.{nameof(GenerateOperators)}"));

public static readonly PerLanguageOption<bool> ImplementIEquatable = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> ImplementIEquatable = new PerLanguageOption2<bool>(
nameof(GenerateEqualsAndGetHashCodeFromMembersOptions),
nameof(ImplementIEquatable), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ internal enum ImplementTypePropertyGenerationBehavior

internal static class ImplementTypeOptions
{
public static readonly PerLanguageOption<ImplementTypeInsertionBehavior> InsertionBehavior =
new PerLanguageOption<ImplementTypeInsertionBehavior>(
public static readonly PerLanguageOption2<ImplementTypeInsertionBehavior> InsertionBehavior =
new PerLanguageOption2<ImplementTypeInsertionBehavior>(
nameof(ImplementTypeOptions),
nameof(InsertionBehavior),
defaultValue: ImplementTypeInsertionBehavior.WithOtherMembersOfTheSameKind,
storageLocations: new RoamingProfileStorageLocation(
$"TextEditor.%LANGUAGE%.{nameof(ImplementTypeOptions)}.{nameof(InsertionBehavior)}"));

public static readonly PerLanguageOption<ImplementTypePropertyGenerationBehavior> PropertyGenerationBehavior =
new PerLanguageOption<ImplementTypePropertyGenerationBehavior>(
public static readonly PerLanguageOption2<ImplementTypePropertyGenerationBehavior> PropertyGenerationBehavior =
new PerLanguageOption2<ImplementTypePropertyGenerationBehavior>(
nameof(ImplementTypeOptions),
nameof(PropertyGenerationBehavior),
defaultValue: ImplementTypePropertyGenerationBehavior.PreferThrowingProperties,
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Core/Portable/Navigation/NavigationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ internal static class NavigationOptions
/// This option can be passed to the <see cref="IDocumentNavigationService"/> APIs to request that a provisional (or preview) tab
/// be used for any document that needs to be opened, if one is available.
/// </summary>
public static readonly Option<bool> PreferProvisionalTab = new Option<bool>(nameof(NavigationOptions), nameof(PreferProvisionalTab), defaultValue: false);
public static readonly Option2<bool> PreferProvisionalTab = new Option2<bool>(nameof(NavigationOptions), nameof(PreferProvisionalTab), defaultValue: false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ namespace Microsoft.CodeAnalysis.Shared.Options
/// </summary>
internal static class ServiceComponentOnOffOptions
{
public static readonly Option<bool> DiagnosticProvider = new Option<bool>(nameof(ServiceComponentOnOffOptions), nameof(DiagnosticProvider), defaultValue: true);
public static readonly Option2<bool> DiagnosticProvider = new Option2<bool>(nameof(ServiceComponentOnOffOptions), nameof(DiagnosticProvider), defaultValue: true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static class ServiceFeatureOnOffOptions
/// <summary>
/// This option is used by TypeScript.
/// </summary>
public static readonly PerLanguageOption<bool> RemoveDocumentDiagnosticsOnDocumentClose = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> RemoveDocumentDiagnosticsOnDocumentClose = new PerLanguageOption2<bool>(
"ServiceFeatureOnOffOptions", "RemoveDocumentDiagnosticsOnDocumentClose", defaultValue: false,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.RemoveDocumentDiagnosticsOnDocumentClose"));
}
Expand Down
Loading

0 comments on commit 3ba9025

Please sign in to comment.