// 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 Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.CodeStyle { public class CodeStyleOptions { /// /// When user preferences are not yet set for a style, we fall back to the default value. /// One such default(s), is that the feature is turned on, so that codegen consumes it, /// but with none enforcement, so that the user is not prompted about their usage. /// internal static readonly CodeStyleOption TrueWithNoneEnforcement = new CodeStyleOption(value: true, notification: NotificationOption.None); internal static readonly CodeStyleOption FalseWithNoneEnforcement = new CodeStyleOption(value: false, notification: NotificationOption.None); internal static readonly CodeStyleOption TrueWithSuggestionEnforcement = new CodeStyleOption(value: true, notification: NotificationOption.Suggestion); internal static readonly CodeStyleOption FalseWithSuggestionEnforcement = new CodeStyleOption(value: false, notification: NotificationOption.Suggestion); /// /// This option says if we should simplify away the . or . in field access expressions. /// public static readonly PerLanguageOption> QualifyFieldAccess = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(QualifyFieldAccess), defaultValue: CodeStyleOption.Default, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.QualifyFieldAccess")); /// /// This option says if we should simplify away the . or . in property access expressions. /// public static readonly PerLanguageOption> QualifyPropertyAccess = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(QualifyPropertyAccess), defaultValue: CodeStyleOption.Default, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.QualifyPropertyAccess")); /// /// This option says if we should simplify away the . or . in method access expressions. /// public static readonly PerLanguageOption> QualifyMethodAccess = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(QualifyMethodAccess), defaultValue: CodeStyleOption.Default, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.QualifyMethodAccess")); /// /// This option says if we should simplify away the . or . in event access expressions. /// public static readonly PerLanguageOption> QualifyEventAccess = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(QualifyEventAccess), defaultValue: CodeStyleOption.Default, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.QualifyEventAccess")); /// /// This option says if we should prefer keyword for Intrinsic Predefined Types in Declarations /// public static readonly PerLanguageOption> PreferIntrinsicPredefinedTypeKeywordInDeclaration = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(PreferIntrinsicPredefinedTypeKeywordInDeclaration), defaultValue: TrueWithNoneEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferIntrinsicPredefinedTypeKeywordInDeclaration")); /// /// This option says if we should prefer keyword for Intrinsic Predefined Types in Member Access Expression /// public static readonly PerLanguageOption> PreferIntrinsicPredefinedTypeKeywordInMemberAccess = new PerLanguageOption>(nameof(CodeStyleOptions), nameof(PreferIntrinsicPredefinedTypeKeywordInMemberAccess), defaultValue: TrueWithNoneEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferIntrinsicPredefinedTypeKeywordInMemberAccess")); internal static readonly PerLanguageOption> PreferThrowExpression = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferThrowExpression), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferThrowExpression")); internal static readonly PerLanguageOption> PreferObjectInitializer = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferObjectInitializer), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferObjectInitializer")); internal static readonly PerLanguageOption> PreferCollectionInitializer = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferCollectionInitializer), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferCollectionInitializer")); internal static readonly PerLanguageOption PreferObjectInitializer_FadeOutCode = new PerLanguageOption( nameof(CodeStyleOptions), nameof(PreferObjectInitializer_FadeOutCode), defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferObjectInitializer_FadeOutCode")); internal static readonly PerLanguageOption PreferCollectionInitializer_FadeOutCode = new PerLanguageOption( nameof(CodeStyleOptions), nameof(PreferCollectionInitializer_FadeOutCode), defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferCollectionInitializer_FadeOutCode")); internal static readonly PerLanguageOption> PreferCoalesceExpression = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferCoalesceExpression), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferCoalesceExpression")); internal static readonly PerLanguageOption> PreferNullPropagation = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferNullPropagation), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferNullPropagation")); internal static readonly PerLanguageOption> PreferInlinedVariableDeclaration = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferInlinedVariableDeclaration), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferInlinedVariableDeclaration")); internal static readonly PerLanguageOption> PreferExplicitTupleNames = new PerLanguageOption>( nameof(CodeStyleOptions), nameof(PreferExplicitTupleNames), defaultValue: TrueWithSuggestionEnforcement, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PreferExplicitTupleNames")); } }