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)
26
newLinesForBracesInObjectCollectionArrayInitializers: 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)
17
private static Option<bool> CreateNewLineForBracesOption(string publicName,
NewLineBeforeOpenBracePlacement
flag)
39
private readonly
NewLineBeforeOpenBracePlacement
_flag;
41
public NewLineForBracesInternalStorageMapping(IOption2 internalOption,
NewLineBeforeOpenBracePlacement
flag)
48
=> ((
NewLineBeforeOpenBracePlacement
)internalValue!).HasFlag(_flag);
51
=> ((
NewLineBeforeOpenBracePlacement
)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!);
164
public static Option<bool> NewLinesForBracesInTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInTypes",
NewLineBeforeOpenBracePlacement
.Types);
165
public static Option<bool> NewLinesForBracesInMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInMethods",
NewLineBeforeOpenBracePlacement
.Methods);
166
public static Option<bool> NewLinesForBracesInProperties { get; } = CreateNewLineForBracesOption("NewLinesForBracesInProperties",
NewLineBeforeOpenBracePlacement
.Properties);
167
public static Option<bool> NewLinesForBracesInAccessors { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAccessors",
NewLineBeforeOpenBracePlacement
.Accessors);
168
public static Option<bool> NewLinesForBracesInAnonymousMethods { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousMethods",
NewLineBeforeOpenBracePlacement
.AnonymousMethods);
169
public static Option<bool> NewLinesForBracesInControlBlocks { get; } = CreateNewLineForBracesOption("NewLinesForBracesInControlBlocks",
NewLineBeforeOpenBracePlacement
.ControlBlocks);
170
public static Option<bool> NewLinesForBracesInAnonymousTypes { get; } = CreateNewLineForBracesOption("NewLinesForBracesInAnonymousTypes",
NewLineBeforeOpenBracePlacement
.AnonymousTypes);
171
public static Option<bool> NewLinesForBracesInObjectCollectionArrayInitializers { get; } = CreateNewLineForBracesOption("NewLinesForBracesInObjectCollectionArrayInitializers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);
172
public static Option<bool> NewLinesForBracesInLambdaExpressionBody { get; } = CreateNewLineForBracesOption("NewLinesForBracesInLambdaExpressionBody",
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpFormattingOptions2.cs (15)
42
private static readonly BidirectionalMap<string,
NewLineBeforeOpenBracePlacement
> s_legacyNewLineOptionsEditorConfigMap =
45
KeyValuePair.Create("object_collection_array_initalizers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers),
47
private static readonly BidirectionalMap<string,
NewLineBeforeOpenBracePlacement
> s_newLineOptionsEditorConfigMap =
50
KeyValuePair.Create("all",
NewLineBeforeOpenBracePlacement
.All),
51
KeyValuePair.Create("accessors",
NewLineBeforeOpenBracePlacement
.Accessors),
52
KeyValuePair.Create("types",
NewLineBeforeOpenBracePlacement
.Types),
53
KeyValuePair.Create("methods",
NewLineBeforeOpenBracePlacement
.Methods),
54
KeyValuePair.Create("properties",
NewLineBeforeOpenBracePlacement
.Properties),
55
KeyValuePair.Create("anonymous_methods",
NewLineBeforeOpenBracePlacement
.AnonymousMethods),
56
KeyValuePair.Create("control_blocks",
NewLineBeforeOpenBracePlacement
.ControlBlocks),
57
KeyValuePair.Create("anonymous_types",
NewLineBeforeOpenBracePlacement
.AnonymousTypes),
58
KeyValuePair.Create("object_collection_array_initializers",
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers),
59
KeyValuePair.Create("lambdas",
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody),
232
public static Option2<
NewLineBeforeOpenBracePlacement
> NewLineBeforeOpenBrace { get; } = CreateOption(
236
new EditorConfigValueSerializer<
NewLineBeforeOpenBracePlacement
>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\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])
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\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 (48)
Formatting\EditorConfigOptionParserTests.cs (32)
68
NewLineBeforeOpenBracePlacement
.Types |
69
NewLineBeforeOpenBracePlacement
.Methods |
70
NewLineBeforeOpenBracePlacement
.Properties |
71
NewLineBeforeOpenBracePlacement
.AnonymousMethods |
72
NewLineBeforeOpenBracePlacement
.ControlBlocks |
73
NewLineBeforeOpenBracePlacement
.AnonymousTypes |
74
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers |
75
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody |
76
NewLineBeforeOpenBracePlacement
.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")]
96
internal 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),
112
var
newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (65)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (12)
20
private static readonly Conversions<
NewLineBeforeOpenBracePlacement
, int> s_newLinesForBracesConversions = new(v => (int)v, v => (
NewLineBeforeOpenBracePlacement
)v);
77
var newLineBeforeOpenBraceValue = new StrongBox<
NewLineBeforeOpenBracePlacement
>();
78
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.Types, CSharpVSResources.Place_open_brace_on_new_line_for_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
79
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);
80
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);
81
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);
82
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.AnonymousMethods, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_methods, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
83
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.ControlBlocks, CSharpVSResources.Place_open_brace_on_new_line_for_control_blocks, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
84
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)
NewLineBeforeOpenBracePlacement
.AnonymousTypes, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService);
85
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);
86
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)
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)
21
private static readonly Conversions<
NewLineBeforeOpenBracePlacement
, int> s_newLinesForBracesConversions = new(v => (int)v, v => (
NewLineBeforeOpenBracePlacement
)v);
235
var newLineBeforeOpenBraceValue = new StrongBox<
NewLineBeforeOpenBracePlacement
>();
236
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));
237
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));
238
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));
239
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));
240
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));
241
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));
242
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));
243
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));
244
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)
126
Assert.Equal(value, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~
NewLineBeforeOpenBracePlacement
.AnonymousTypes);
139
Assert.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),
154
Assert.Equal((optionKey,
NewLineBeforeOpenBracePlacement
.Accessors |
NewLineBeforeOpenBracePlacement
.LambdaExpressionBody), refreshedOptions.Single());
Options\VisualStudioStorageReadFallbackTests.cs (3)
53
Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value,
NewLineBeforeOpenBracePlacement
.All);
58
CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);
63
CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue |
NewLineBeforeOpenBracePlacement
.ObjectCollectionArrayInitializers);