211 references to NewLineBeforeOpenBracePlacement
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (18)
AutomaticCompletion\AutomaticBraceCompletionTests.cs (12)
786
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) }
862
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) }
934
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) }
996
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) }
1058
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) }
1383
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, bracesOnNewLine) }
1427
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, bracesOnNewLine) }
1471
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.Accessors, bracesOnNewLine) }
1515
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.AnonymousMethods, bracesOnNewLine) }
1559
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.AnonymousTypes, bracesOnNewLine) }
1604
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, bracesOnNewLine) }
1655
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, bracesOnNewLine) }
ConvertAutoPropertyToFullProperty\ConvertAutoPropertyToFullPropertyTests_OptionSets.cs (4)
37
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.All & ~
NewLineBeforeOpenBracePlacement
.Properties },
44
{ CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.All & ~
NewLineBeforeOpenBracePlacement
.Accessors },
InitializeParameter\InitializeMemberFromParameterTests.cs (2)
1678
""", options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.All & ~
NewLineBeforeOpenBracePlacement
.Methods));
Microsoft.CodeAnalysis.CSharp.Features (2)
Wrapping\CSharpSyntaxWrappingOptions.cs (2)
33
var
newLineBeforeOpenBraceDefault = ((CSharpSyntaxFormattingOptions)fallbackOptions.CleanupOptions.FormattingOptions).NewLines.ToNewLineBeforeOpenBracePlacement();
39
newLinesForBracesInObjectCollectionArrayInitializers: options.GetOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, newLineBeforeOpenBraceDefault).HasFlag(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers));
Microsoft.CodeAnalysis.CSharp.Workspaces (60)
CSharpFormattingOptions2.cs (15)
47
private static readonly BidirectionalMap<string,
NewLineBeforeOpenBracePlacement
> s_legacyNewLineOptionsEditorConfigMap =
50
KeyValuePairUtil.Create("object_collection_array_initalizers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers),
52
private static readonly BidirectionalMap<string,
NewLineBeforeOpenBracePlacement
> s_newLineOptionsEditorConfigMap =
55
KeyValuePairUtil.Create("all",
NewLineBeforeOpenBracePlacement
.All),
56
KeyValuePairUtil.Create("accessors",
NewLineBeforeOpenBracePlacement
.Accessors),
57
KeyValuePairUtil.Create("types",
NewLineBeforeOpenBracePlacement
.Types),
58
KeyValuePairUtil.Create("methods",
NewLineBeforeOpenBracePlacement
.Methods),
59
KeyValuePairUtil.Create("properties",
NewLineBeforeOpenBracePlacement
.Properties),
60
KeyValuePairUtil.Create("anonymous_methods",
NewLineBeforeOpenBracePlacement
.AnonymousMethods),
61
KeyValuePairUtil.Create("control_blocks",
NewLineBeforeOpenBracePlacement
.ControlBlocks),
62
KeyValuePairUtil.Create("anonymous_types",
NewLineBeforeOpenBracePlacement
.AnonymousTypes),
63
KeyValuePairUtil.Create("object_collection_array_initializers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers),
64
KeyValuePairUtil.Create("lambdas",
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody),
239
public static Option2<
NewLineBeforeOpenBracePlacement
> NewLineBeforeOpenBrace { get; } = CreateOption(
243
new EditorConfigValueSerializer<
NewLineBeforeOpenBracePlacement
>(
CSharpFormattingOptions2.Parsers.cs (8)
76
internal static
NewLineBeforeOpenBracePlacement
ParseNewLineBeforeOpenBracePlacementList(string list)
77
=> (
NewLineBeforeOpenBracePlacement
)ParseEditorConfigFlags(
79
static s => s_newLineOptionsEditorConfigMap.TryGetValue(s, out
var
v) ? (int)v : s_legacyNewLineOptionsEditorConfigMap.TryGetValue(s, out v) ? (int)v : 0,
82
allValue: (int)
NewLineBeforeOpenBracePlacement
.All);
84
internal static string ToEditorConfigValue(
NewLineBeforeOpenBracePlacement
value)
87
NewLineBeforeOpenBracePlacement
.None => "none",
88
NewLineBeforeOpenBracePlacement
.All => "all",
89
_ => ToEditorConfigFlagList((int)value, static v => s_newLineOptionsEditorConfigMap[(
NewLineBeforeOpenBracePlacement
)v])
Formatting\CSharpFormattingOptions.cs (14)
18
private static Option<bool> CreateNewLineForBracesOption(string publicName,
NewLineBeforeOpenBracePlacement
flag)
40
private readonly
NewLineBeforeOpenBracePlacement
_flag;
42
public NewLineForBracesInternalStorageMapping(IOption2 internalOption,
NewLineBeforeOpenBracePlacement
flag)
49
=> ((
NewLineBeforeOpenBracePlacement
)internalValue!).HasFlag(_flag);
52
=> ((
NewLineBeforeOpenBracePlacement
)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!);
163
public static Option<bool> NewLinesForBracesInTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInTypes",
NewLineBeforeOpenBracePlacement
.Types);
164
public static Option<bool> NewLinesForBracesInMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInMethods",
NewLineBeforeOpenBracePlacement
.Methods);
165
public static Option<bool> NewLinesForBracesInProperties { get; } = CreateNewLineForBracesOption("NewLinesForBracesInProperties",
NewLineBeforeOpenBracePlacement
.Properties);
166
public static Option<bool> NewLinesForBracesInAccessors { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAccessors",
NewLineBeforeOpenBracePlacement
.Accessors);
167
public static Option<bool> NewLinesForBracesInAnonymousMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousMethods",
NewLineBeforeOpenBracePlacement
.AnonymousMethods);
168
public static Option<bool> NewLinesForBracesInControlBlocks { get; } = CreateNewLineForBracesOption("NewLinesForBracesInControlBlocks",
NewLineBeforeOpenBracePlacement
.ControlBlocks);
169
public static Option<bool> NewLinesForBracesInAnonymousTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousTypes",
NewLineBeforeOpenBracePlacement
.AnonymousTypes);
170
public static Option<bool> NewLinesForBracesInObjectCollectionArrayInitializers { get; } = CreateNewLineForBracesOption("NewLinesForBracesInObjectCollectionArrayInitializers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);
171
public static Option<bool> NewLinesForBracesInLambdaExpressionBody { get; } = CreateNewLineForBracesOption("NewLinesForBracesInLambdaExpressionBody",
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody);
NewLineBeforeOpenBracePlacement.cs (23)
27
public 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);
38
public 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);
49
public static
NewLineBeforeOpenBracePlacement
WithFlagValue(this
NewLineBeforeOpenBracePlacement
flags,
NewLineBeforeOpenBracePlacement
flag, bool value)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (47)
Formatting\EditorConfigOptionParserTests.cs (32)
76
NewLineBeforeOpenBracePlacement
.Types |
77
NewLineBeforeOpenBracePlacement
.Methods |
78
NewLineBeforeOpenBracePlacement
.Properties |
79
NewLineBeforeOpenBracePlacement
.AnonymousMethods |
80
NewLineBeforeOpenBracePlacement
.ControlBlocks |
81
NewLineBeforeOpenBracePlacement
.AnonymousTypes |
82
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers |
83
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody |
84
NewLineBeforeOpenBracePlacement
.Accessors, "all")]
85
[InlineData("all,none",
NewLineBeforeOpenBracePlacement
.All, "all")]
86
[InlineData("none,all",
NewLineBeforeOpenBracePlacement
.All, "all")]
87
[InlineData("types",
NewLineBeforeOpenBracePlacement
.Types, "types")]
88
[InlineData("types,methods",
NewLineBeforeOpenBracePlacement
.Types |
NewLineBeforeOpenBracePlacement
.Methods, "types,methods")]
89
[InlineData("methods,types",
NewLineBeforeOpenBracePlacement
.Types |
NewLineBeforeOpenBracePlacement
.Methods, "types,methods")]
90
[InlineData("methods, properties",
NewLineBeforeOpenBracePlacement
.Methods |
NewLineBeforeOpenBracePlacement
.Properties, "methods,properties")]
91
[InlineData(",, types",
NewLineBeforeOpenBracePlacement
.Types, "types")]
92
[InlineData("accessors",
NewLineBeforeOpenBracePlacement
.Accessors, "accessors")]
93
[InlineData("methods",
NewLineBeforeOpenBracePlacement
.Methods, "methods")]
94
[InlineData("properties",
NewLineBeforeOpenBracePlacement
.Properties, "properties")]
95
[InlineData("anonymous_methods",
NewLineBeforeOpenBracePlacement
.AnonymousMethods, "anonymous_methods")]
96
[InlineData("control_blocks",
NewLineBeforeOpenBracePlacement
.ControlBlocks, "control_blocks")]
97
[InlineData("anonymous_types",
NewLineBeforeOpenBracePlacement
.AnonymousTypes, "anonymous_types")]
98
[InlineData("object_collection_array_initalizers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, "object_collection_array_initializers")]
99
[InlineData("object_collection_array_initializers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, "object_collection_array_initializers")]
100
[InlineData("lambdas",
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody, "lambdas")]
101
[InlineData("Accessors",
NewLineBeforeOpenBracePlacement
.None, "none")]
102
[InlineData("none,types",
NewLineBeforeOpenBracePlacement
.None, "none")]
103
[InlineData(",,,",
NewLineBeforeOpenBracePlacement
.None, "none")]
104
internal void TestParseNewLineBeforeOpenBracePlacementList(string list,
NewLineBeforeOpenBracePlacement
value, string roundtrip)
Formatting\FormattingTests.cs (15)
963
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) },
1038
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody, false) },
1884
{ NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.None }
2134
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, false) }
7268
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, false) }
7307
{ NewLineBeforeOpenBrace , NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, false) }
8485
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ControlBlocks, false) }
8628
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.Properties, false) },
8666
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.Accessors, false) },
8705
.WithFlagValue(
NewLineBeforeOpenBracePlacement
.Properties, false)
8706
.WithFlagValue(
NewLineBeforeOpenBracePlacement
.Accessors, false)},
9757
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) },
9817
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) },
9927
{ NewLineBeforeOpenBrace, NewLineBeforeOpenBrace.DefaultValue.WithFlagValue(
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, false) },
9963
{ 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),
112
var
newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (65)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (12)
24
private static readonly Conversions<
NewLineBeforeOpenBracePlacement
, int> s_newLinesForBracesConversions = new(v => (int)v, v => (
NewLineBeforeOpenBracePlacement
)v);
81
var newLineBeforeOpenBraceValue = new StrongBox<
NewLineBeforeOpenBracePlacement
>();
82
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.Types, CSharpVSResources.Place_open_brace_on_new_line_for_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
83
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.Methods, CSharpVSResources.Place_open_brace_on_new_line_for_methods_local_functions, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
84
yield 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);
85
yield 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);
86
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.AnonymousMethods, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_methods, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
87
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.ControlBlocks, CSharpVSResources.Place_open_brace_on_new_line_for_control_blocks, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
88
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.AnonymousTypes, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
89
yield 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);
90
yield 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)
27
private int GetBooleanOption(Option2<
NewLineBeforeOpenBracePlacement
> option,
NewLineBeforeOpenBracePlacement
flag)
39
private void SetBooleanOption(Option2<
NewLineBeforeOpenBracePlacement
> option,
NewLineBeforeOpenBracePlacement
flag, int value)
Options\AutomationObject\AutomationObject.Formatting.cs (18)
62
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.AnonymousMethods); }
63
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.AnonymousMethods, value); }
68
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.AnonymousTypes); }
69
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.AnonymousTypes, value); }
74
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.ControlBlocks); }
75
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.ControlBlocks, value); }
80
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody); }
81
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody, value); }
86
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Methods); }
87
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Methods, value); }
92
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Properties); }
93
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Properties, value); }
98
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Accessors); }
99
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Accessors, value); }
104
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers); }
105
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers, value); }
110
get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Types); }
111
set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace,
NewLineBeforeOpenBracePlacement
.Types, value); }
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (10)
44
("TextEditor.CSharp.Specific.NewLinesForBracesInTypes", (int)
NewLineBeforeOpenBracePlacement
.Types),
45
("TextEditor.CSharp.Specific.NewLinesForBracesInAnonymousTypes", (int)
NewLineBeforeOpenBracePlacement
.AnonymousTypes),
46
("TextEditor.CSharp.Specific.NewLinesForBracesInObjectCollectionArrayInitializers", (int)
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers),
47
("TextEditor.CSharp.Specific.NewLinesForBracesInProperties", (int)
NewLineBeforeOpenBracePlacement
.Properties),
48
("TextEditor.CSharp.Specific.NewLinesForBracesInMethods", (int)
NewLineBeforeOpenBracePlacement
.Methods),
49
("TextEditor.CSharp.Specific.NewLinesForBracesInAccessors", (int)
NewLineBeforeOpenBracePlacement
.Accessors),
50
("TextEditor.CSharp.Specific.NewLinesForBracesInAnonymousMethods", (int)
NewLineBeforeOpenBracePlacement
.AnonymousMethods),
51
("TextEditor.CSharp.Specific.NewLinesForBracesInLambdaExpressionBody", (int)
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody),
52
("TextEditor.CSharp.Specific.NewLinesForBracesInControlBlocks", (int)
NewLineBeforeOpenBracePlacement
.ControlBlocks));
61
=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue, readValue, out var intValue) ? (
NewLineBeforeOpenBracePlacement
)intValue : default(Optional<object?>);
Options\Formatting\NewLinesViewModel.cs (21)
22
private static readonly Conversions<
NewLineBeforeOpenBracePlacement
, int> s_newLinesForBracesConversions = new(v => (int)v, v => (
NewLineBeforeOpenBracePlacement
)v);
210
var newLineBeforeOpenBraceValue = new StrongBox<
NewLineBeforeOpenBracePlacement
>();
211
Items.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));
212
Items.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));
213
Items.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));
214
Items.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));
215
Items.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));
216
Items.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));
217
Items.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));
218
Items.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));
219
Items.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)
137
Assert.Equal(value, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~
NewLineBeforeOpenBracePlacement
.AnonymousTypes);
150
Assert.Equal((optionKey, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~
NewLineBeforeOpenBracePlacement
.Methods), refreshedOptions.Single());
157
"TextEditor.CSharp.Specific.csharp_new_line_before_open_brace" => (GetValueResult.Success,
NewLineBeforeOpenBracePlacement
.Accessors |
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody),
165
Assert.Equal((optionKey,
NewLineBeforeOpenBracePlacement
.Accessors |
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody), refreshedOptions.Single());
Options\VisualStudioStorageReadFallbackTests.cs (3)
52
Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value,
NewLineBeforeOpenBracePlacement
.All);
57
CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);
62
CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue |
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);