214 references to NewLineBeforeOpenBracePlacement
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (16)
AutomaticCompletion\AutomaticBraceCompletionTests.cs (12)
813{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) } 888{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) } 967{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) } 1031{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) } 1095{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) } 1437{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, bracesOnNewLine) } 1484{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, bracesOnNewLine) } 1531{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.Accessors, bracesOnNewLine) } 1578{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.AnonymousMethods, bracesOnNewLine) } 1625{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.AnonymousTypes, bracesOnNewLine) } 1673{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, bracesOnNewLine) } 1727{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, bracesOnNewLine) }
CodeActions\InitializeParameter\InitializeMemberFromParameterTests.cs (2)
1550""", new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Methods)));
CodeActions\InitializeParameter\InitializeMemberFromPrimaryConstructorParameterTests.cs (2)
979""", new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Types)));
Microsoft.CodeAnalysis.CSharp.Features (1)
Wrapping\CSharpSyntaxWrappingOptions.cs (1)
26newLinesForBracesInObjectCollectionArrayInitializers: options.GetOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace).HasFlag(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (5)
ConvertAutoPropertyToFullProperty\ConvertAutoPropertyToFullPropertyTests_OptionSets.cs (4)
34{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Properties }, 41{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Accessors },
src\Analyzers\CSharp\Tests\ConvertNamespace\ConvertToBlockScopedNamespaceAnalyzerTests.cs (1)
256{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.Types },
Microsoft.CodeAnalysis.CSharp.Workspaces (60)
Formatting\CSharpFormattingOptions.cs (14)
17private static Option<bool> CreateNewLineForBracesOption(string publicName, NewLineBeforeOpenBracePlacement flag) 39private readonly NewLineBeforeOpenBracePlacement _flag; 41public NewLineForBracesInternalStorageMapping(IOption2 internalOption, NewLineBeforeOpenBracePlacement flag) 48=> ((NewLineBeforeOpenBracePlacement)internalValue!).HasFlag(_flag); 51=> ((NewLineBeforeOpenBracePlacement)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!); 164public static Option<bool> NewLinesForBracesInTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInTypes", NewLineBeforeOpenBracePlacement.Types); 165public static Option<bool> NewLinesForBracesInMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInMethods", NewLineBeforeOpenBracePlacement.Methods); 166public static Option<bool> NewLinesForBracesInProperties { get; } = CreateNewLineForBracesOption("NewLinesForBracesInProperties", NewLineBeforeOpenBracePlacement.Properties); 167public static Option<bool> NewLinesForBracesInAccessors { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAccessors", NewLineBeforeOpenBracePlacement.Accessors); 168public static Option<bool> NewLinesForBracesInAnonymousMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousMethods", NewLineBeforeOpenBracePlacement.AnonymousMethods); 169public static Option<bool> NewLinesForBracesInControlBlocks { get; } = CreateNewLineForBracesOption("NewLinesForBracesInControlBlocks", NewLineBeforeOpenBracePlacement.ControlBlocks); 170public static Option<bool> NewLinesForBracesInAnonymousTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousTypes", NewLineBeforeOpenBracePlacement.AnonymousTypes); 171public static Option<bool> NewLinesForBracesInObjectCollectionArrayInitializers { get; } = CreateNewLineForBracesOption("NewLinesForBracesInObjectCollectionArrayInitializers", NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers); 172public static Option<bool> NewLinesForBracesInLambdaExpressionBody { get; } = CreateNewLineForBracesOption("NewLinesForBracesInLambdaExpressionBody", NewLineBeforeOpenBracePlacement.LambdaExpressionBody);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpFormattingOptions2.cs (15)
42private static readonly BidirectionalMap<string, NewLineBeforeOpenBracePlacement> s_legacyNewLineOptionsEditorConfigMap = 45KeyValuePair.Create("object_collection_array_initalizers", NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers), 47private static readonly BidirectionalMap<string, NewLineBeforeOpenBracePlacement> s_newLineOptionsEditorConfigMap = 50KeyValuePair.Create("all", NewLineBeforeOpenBracePlacement.All), 51KeyValuePair.Create("accessors", NewLineBeforeOpenBracePlacement.Accessors), 52KeyValuePair.Create("types", NewLineBeforeOpenBracePlacement.Types), 53KeyValuePair.Create("methods", NewLineBeforeOpenBracePlacement.Methods), 54KeyValuePair.Create("properties", NewLineBeforeOpenBracePlacement.Properties), 55KeyValuePair.Create("anonymous_methods", NewLineBeforeOpenBracePlacement.AnonymousMethods), 56KeyValuePair.Create("control_blocks", NewLineBeforeOpenBracePlacement.ControlBlocks), 57KeyValuePair.Create("anonymous_types", NewLineBeforeOpenBracePlacement.AnonymousTypes), 58KeyValuePair.Create("object_collection_array_initializers", NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers), 59KeyValuePair.Create("lambdas", NewLineBeforeOpenBracePlacement.LambdaExpressionBody), 232public static Option2<NewLineBeforeOpenBracePlacement> NewLineBeforeOpenBrace { get; } = CreateOption( 236new EditorConfigValueSerializer<NewLineBeforeOpenBracePlacement>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpFormattingOptions2.Parsers.cs (8)
76internal static NewLineBeforeOpenBracePlacement ParseNewLineBeforeOpenBracePlacementList(string list) 77=> (NewLineBeforeOpenBracePlacement)ParseEditorConfigFlags( 79static s => s_newLineOptionsEditorConfigMap.TryGetValue(s, out var v) ? (int)v : s_legacyNewLineOptionsEditorConfigMap.TryGetValue(s, out v) ? (int)v : 0, 82allValue: (int)NewLineBeforeOpenBracePlacement.All); 84internal static string ToEditorConfigValue(NewLineBeforeOpenBracePlacement value) 87NewLineBeforeOpenBracePlacement.None => "none", 88NewLineBeforeOpenBracePlacement.All => "all", 89_ => ToEditorConfigFlagList((int)value, static v => s_newLineOptionsEditorConfigMap[(NewLineBeforeOpenBracePlacement)v])
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\NewLineBeforeOpenBracePlacement.cs (23)
27public static NewLineBeforeOpenBracePlacement ToNewLineBeforeOpenBracePlacement(this NewLinePlacement value) 28=> (value.HasFlag(NewLinePlacement.BeforeOpenBraceInTypes) ? NewLineBeforeOpenBracePlacement.Types : 0) | 29(value.HasFlag(NewLinePlacement.BeforeOpenBraceInMethods) ? NewLineBeforeOpenBracePlacement.Methods : 0) | 30(value.HasFlag(NewLinePlacement.BeforeOpenBraceInProperties) ? NewLineBeforeOpenBracePlacement.Properties : 0) | 31(value.HasFlag(NewLinePlacement.BeforeOpenBraceInAnonymousMethods) ? NewLineBeforeOpenBracePlacement.AnonymousMethods : 0) | 32(value.HasFlag(NewLinePlacement.BeforeOpenBraceInControlBlocks) ? NewLineBeforeOpenBracePlacement.ControlBlocks : 0) | 33(value.HasFlag(NewLinePlacement.BeforeOpenBraceInAnonymousTypes) ? NewLineBeforeOpenBracePlacement.AnonymousTypes : 0) | 34(value.HasFlag(NewLinePlacement.BeforeOpenBraceInObjectCollectionArrayInitializers) ? NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers : 0) | 35(value.HasFlag(NewLinePlacement.BeforeOpenBraceInLambdaExpressionBody) ? NewLineBeforeOpenBracePlacement.LambdaExpressionBody : 0) | 36(value.HasFlag(NewLinePlacement.BeforeOpenBraceInAccessors) ? NewLineBeforeOpenBracePlacement.Accessors : 0); 38public static NewLinePlacement ToNewLinePlacement(this NewLineBeforeOpenBracePlacement value) 39=> (value.HasFlag(NewLineBeforeOpenBracePlacement.Types) ? NewLinePlacement.BeforeOpenBraceInTypes : 0) | 40(value.HasFlag(NewLineBeforeOpenBracePlacement.Methods) ? NewLinePlacement.BeforeOpenBraceInMethods : 0) | 41(value.HasFlag(NewLineBeforeOpenBracePlacement.Properties) ? NewLinePlacement.BeforeOpenBraceInProperties : 0) | 42(value.HasFlag(NewLineBeforeOpenBracePlacement.AnonymousMethods) ? NewLinePlacement.BeforeOpenBraceInAnonymousMethods : 0) | 43(value.HasFlag(NewLineBeforeOpenBracePlacement.ControlBlocks) ? NewLinePlacement.BeforeOpenBraceInControlBlocks : 0) | 44(value.HasFlag(NewLineBeforeOpenBracePlacement.AnonymousTypes) ? NewLinePlacement.BeforeOpenBraceInAnonymousTypes : 0) | 45(value.HasFlag(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers) ? NewLinePlacement.BeforeOpenBraceInObjectCollectionArrayInitializers : 0) | 46(value.HasFlag(NewLineBeforeOpenBracePlacement.LambdaExpressionBody) ? NewLinePlacement.BeforeOpenBraceInLambdaExpressionBody : 0) | 47(value.HasFlag(NewLineBeforeOpenBracePlacement.Accessors) ? NewLinePlacement.BeforeOpenBraceInAccessors : 0); 49public static NewLineBeforeOpenBracePlacement WithFlagValue(this NewLineBeforeOpenBracePlacement flags, NewLineBeforeOpenBracePlacement flag, bool value)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (48)
Formatting\EditorConfigOptionParserTests.cs (32)
68NewLineBeforeOpenBracePlacement.Types | 69NewLineBeforeOpenBracePlacement.Methods | 70NewLineBeforeOpenBracePlacement.Properties | 71NewLineBeforeOpenBracePlacement.AnonymousMethods | 72NewLineBeforeOpenBracePlacement.ControlBlocks | 73NewLineBeforeOpenBracePlacement.AnonymousTypes | 74NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers | 75NewLineBeforeOpenBracePlacement.LambdaExpressionBody | 76NewLineBeforeOpenBracePlacement.Accessors, "all")] 77[InlineData("all,none", NewLineBeforeOpenBracePlacement.All, "all")] 78[InlineData("none,all", NewLineBeforeOpenBracePlacement.All, "all")] 79[InlineData("types", NewLineBeforeOpenBracePlacement.Types, "types")] 80[InlineData("types,methods", NewLineBeforeOpenBracePlacement.Types | NewLineBeforeOpenBracePlacement.Methods, "types,methods")] 81[InlineData("methods,types", NewLineBeforeOpenBracePlacement.Types | NewLineBeforeOpenBracePlacement.Methods, "types,methods")] 82[InlineData("methods, properties", NewLineBeforeOpenBracePlacement.Methods | NewLineBeforeOpenBracePlacement.Properties, "methods,properties")] 83[InlineData(",, types", NewLineBeforeOpenBracePlacement.Types, "types")] 84[InlineData("accessors", NewLineBeforeOpenBracePlacement.Accessors, "accessors")] 85[InlineData("methods", NewLineBeforeOpenBracePlacement.Methods, "methods")] 86[InlineData("properties", NewLineBeforeOpenBracePlacement.Properties, "properties")] 87[InlineData("anonymous_methods", NewLineBeforeOpenBracePlacement.AnonymousMethods, "anonymous_methods")] 88[InlineData("control_blocks", NewLineBeforeOpenBracePlacement.ControlBlocks, "control_blocks")] 89[InlineData("anonymous_types", NewLineBeforeOpenBracePlacement.AnonymousTypes, "anonymous_types")] 90[InlineData("object_collection_array_initalizers", NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, "object_collection_array_initializers")] 91[InlineData("object_collection_array_initializers", NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, "object_collection_array_initializers")] 92[InlineData("lambdas", NewLineBeforeOpenBracePlacement.LambdaExpressionBody, "lambdas")] 93[InlineData("Accessors", NewLineBeforeOpenBracePlacement.None, "none")] 94[InlineData("none,types", NewLineBeforeOpenBracePlacement.None, "none")] 95[InlineData(",,,", NewLineBeforeOpenBracePlacement.None, "none")] 96internal void TestParseNewLineBeforeOpenBracePlacementList(string list, NewLineBeforeOpenBracePlacement value, string roundtrip)
Formatting\FormattingTests.cs (16)
975{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) }, 1058{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.LambdaExpressionBody, false) }, 1964{ NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.None } 2224{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, false) } 7576{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, false) } 7610{ NewLineBeforeOpenBrace , NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, false) } 8805{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ControlBlocks, false) } 8965{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.Properties, false) }, 9007{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.Accessors, false) }, 9050.WithFlagValue(NewLineBeforeOpenBracePlacement.Properties, false) 9051.WithFlagValue(NewLineBeforeOpenBracePlacement.Accessors, false)}, 10196{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) }, 10262{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) }, 10378{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) }, 10418{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, false) }, 10460{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, option) },
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
Options\DocumentOptionSetTests.cs (10)
97(CSharpFormattingOptions.NewLinesForBracesInTypes, NewLineBeforeOpenBracePlacement.Types), 98(CSharpFormattingOptions.NewLinesForBracesInMethods, NewLineBeforeOpenBracePlacement.Methods), 99(CSharpFormattingOptions.NewLinesForBracesInProperties, NewLineBeforeOpenBracePlacement.Properties), 100(CSharpFormattingOptions.NewLinesForBracesInAccessors, NewLineBeforeOpenBracePlacement.Accessors), 101(CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods, NewLineBeforeOpenBracePlacement.AnonymousMethods), 102(CSharpFormattingOptions.NewLinesForBracesInControlBlocks, NewLineBeforeOpenBracePlacement.ControlBlocks), 103(CSharpFormattingOptions.NewLinesForBracesInAnonymousTypes, NewLineBeforeOpenBracePlacement.AnonymousTypes), 104(CSharpFormattingOptions.NewLinesForBracesInObjectCollectionArrayInitializers, NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers), 105(CSharpFormattingOptions.NewLinesForBracesInLambdaExpressionBody, NewLineBeforeOpenBracePlacement.LambdaExpressionBody), 112var newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (65)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (12)
20private static readonly Conversions<NewLineBeforeOpenBracePlacement, int> s_newLinesForBracesConversions = new(v => (int)v, v => (NewLineBeforeOpenBracePlacement)v); 77var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>(); 78yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Types, CSharpVSResources.Place_open_brace_on_new_line_for_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 79yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Methods, CSharpVSResources.Place_open_brace_on_new_line_for_methods_local_functions, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 80yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Properties, CSharpVSResources.Place_open_brace_on_new_line_for_properties_indexers_and_events, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 81yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Accessors, CSharpVSResources.Place_open_brace_on_new_line_for_property_indexer_and_event_accessors, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 82yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousMethods, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_methods, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 83yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.ControlBlocks, CSharpVSResources.Place_open_brace_on_new_line_for_control_blocks, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 84yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousTypes, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 85yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, CSharpVSResources.Place_open_brace_on_new_line_for_object_collection_array_and_with_initializers, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 86yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.LambdaExpressionBody, CSharpVSResources.Place_open_brace_on_new_line_for_lambda_expression, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
Options\AutomationObject\AutomationObject.cs (4)
27private int GetBooleanOption(Option2<NewLineBeforeOpenBracePlacement> option, NewLineBeforeOpenBracePlacement flag) 39private void SetBooleanOption(Option2<NewLineBeforeOpenBracePlacement> option, NewLineBeforeOpenBracePlacement flag, int value)
Options\AutomationObject\AutomationObject.Formatting.cs (18)
62get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousMethods); } 63set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousMethods, value); } 68get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousTypes); } 69set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousTypes, value); } 74get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ControlBlocks); } 75set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ControlBlocks, value); } 80get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.LambdaExpressionBody); } 81set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.LambdaExpressionBody, value); } 86get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Methods); } 87set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Methods, value); } 92get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Properties); } 93set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Properties, value); } 98get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Accessors); } 99set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Accessors, value); } 104get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers); } 105set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, value); } 110get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Types); } 111set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Types, value); }
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (10)
42("TextEditor.CSharp.Specific.NewLinesForBracesInTypes", (int)NewLineBeforeOpenBracePlacement.Types), 43("TextEditor.CSharp.Specific.NewLinesForBracesInAnonymousTypes", (int)NewLineBeforeOpenBracePlacement.AnonymousTypes), 44("TextEditor.CSharp.Specific.NewLinesForBracesInObjectCollectionArrayInitializers", (int)NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers), 45("TextEditor.CSharp.Specific.NewLinesForBracesInProperties", (int)NewLineBeforeOpenBracePlacement.Properties), 46("TextEditor.CSharp.Specific.NewLinesForBracesInMethods", (int)NewLineBeforeOpenBracePlacement.Methods), 47("TextEditor.CSharp.Specific.NewLinesForBracesInAccessors", (int)NewLineBeforeOpenBracePlacement.Accessors), 48("TextEditor.CSharp.Specific.NewLinesForBracesInAnonymousMethods", (int)NewLineBeforeOpenBracePlacement.AnonymousMethods), 49("TextEditor.CSharp.Specific.NewLinesForBracesInLambdaExpressionBody", (int)NewLineBeforeOpenBracePlacement.LambdaExpressionBody), 50("TextEditor.CSharp.Specific.NewLinesForBracesInControlBlocks", (int)NewLineBeforeOpenBracePlacement.ControlBlocks), 60=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue, readValue, out var intValue) ? (NewLineBeforeOpenBracePlacement)intValue : default(Optional<object?>);
Options\Formatting\NewLinesViewModel.cs (21)
21private static readonly Conversions<NewLineBeforeOpenBracePlacement, int> s_newLinesForBracesConversions = new(v => (int)v, v => (NewLineBeforeOpenBracePlacement)v); 235var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>(); 236Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Types, CSharpVSResources.Place_open_brace_on_new_line_for_types, s_previewText, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 237Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Methods, CSharpVSResources.Place_open_brace_on_new_line_for_methods_local_functions, s_methodPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 238Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Properties, CSharpVSResources.Place_open_brace_on_new_line_for_properties_indexers_and_events, s_propertyPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 239Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Accessors, CSharpVSResources.Place_open_brace_on_new_line_for_property_indexer_and_event_accessors, s_propertyPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 240Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousMethods, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_methods, s_anonymousMethodPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 241Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.ControlBlocks, CSharpVSResources.Place_open_brace_on_new_line_for_control_blocks, s_forBlockPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 242Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousTypes, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_types, s_anonymousTypePreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 243Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, CSharpVSResources.Place_open_brace_on_new_line_for_object_collection_array_and_with_initializers, s_InitializerPreviewTrue, s_InitializerPreviewFalse, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions)); 244Items.Add(new CheckBoxEnumFlagsOptionViewModel<NewLineBeforeOpenBracePlacement>(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.LambdaExpressionBody, CSharpVSResources.Place_open_brace_on_new_line_for_lambda_expression, s_lambdaPreview, this, optionStore, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions));
Roslyn.VisualStudio.Next.UnitTests (9)
Options\VisualStudioSettingsOptionPersisterTests.cs (6)
126Assert.Equal(value, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.AnonymousTypes); 139Assert.Equal((optionKey, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.Methods), refreshedOptions.Single()); 146"TextEditor.CSharp.Specific.csharp_new_line_before_open_brace" => (GetValueResult.Success, NewLineBeforeOpenBracePlacement.Accessors | NewLineBeforeOpenBracePlacement.LambdaExpressionBody), 154Assert.Equal((optionKey, NewLineBeforeOpenBracePlacement.Accessors | NewLineBeforeOpenBracePlacement.LambdaExpressionBody), refreshedOptions.Single());
Options\VisualStudioStorageReadFallbackTests.cs (3)
53Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value, NewLineBeforeOpenBracePlacement.All); 58CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers); 63CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue | NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers);