91 references to SpacePlacementWithinParentheses
Microsoft.CodeAnalysis.CSharp.Workspaces (31)
CSharpFormattingOptions2.cs (6)
26
private static readonly BidirectionalMap<string,
SpacePlacementWithinParentheses
> s_spacingWithinParenthesisOptionsEditorConfigMap =
29
KeyValuePairUtil.Create("expressions",
SpacePlacementWithinParentheses
.Expressions),
30
KeyValuePairUtil.Create("type_casts",
SpacePlacementWithinParentheses
.TypeCasts),
31
KeyValuePairUtil.Create("control_flow_statements",
SpacePlacementWithinParentheses
.ControlFlowStatements),
112
public static Option2<
SpacePlacementWithinParentheses
> SpaceBetweenParentheses { get; } = CreateOption(
116
new EditorConfigValueSerializer<
SpacePlacementWithinParentheses
>(
CSharpFormattingOptions2.Parsers.cs (6)
69
internal static
SpacePlacementWithinParentheses
ParseSpacingWithinParenthesesList(string list)
70
=> (
SpacePlacementWithinParentheses
)ParseEditorConfigFlags(list, static s => s_spacingWithinParenthesisOptionsEditorConfigMap.TryGetValue(s, out
var
v) ? (int)v : 0);
72
internal static string ToEditorConfigValue(
SpacePlacementWithinParentheses
value)
73
=> (value ==
SpacePlacementWithinParentheses
.None) ? "false" :
74
ToEditorConfigFlagList((int)value, static v => s_spacingWithinParenthesisOptionsEditorConfigMap[(
SpacePlacementWithinParentheses
)v]);
Formatting\CSharpFormattingOptions.cs (8)
28
private static Option<bool> CreateSpaceWithinOption(string publicName,
SpacePlacementWithinParentheses
flag)
57
private readonly
SpacePlacementWithinParentheses
_flag;
59
public SpacePlacementInternalStorageMapping(IOption2 internalOption,
SpacePlacementWithinParentheses
flag)
66
=> ((
SpacePlacementWithinParentheses
)internalValue!).HasFlag(_flag);
69
=> ((
SpacePlacementWithinParentheses
)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!);
93
public static Option<bool> SpaceWithinExpressionParentheses { get; } = CreateSpaceWithinOption("SpaceWithinExpressionParentheses",
SpacePlacementWithinParentheses
.Expressions);
94
public static Option<bool> SpaceWithinCastParentheses { get; } = CreateSpaceWithinOption("SpaceWithinCastParentheses",
SpacePlacementWithinParentheses
.TypeCasts);
95
public static Option<bool> SpaceWithinOtherParentheses { get; } = CreateSpaceWithinOption("SpaceWithinOtherParentheses",
SpacePlacementWithinParentheses
.ControlFlowStatements);
SpacingWithinParentheses.cs (11)
21
public static
SpacePlacementWithinParentheses
ToSpacingWithinParentheses(this SpacePlacement placement)
22
=> (placement.HasFlag(SpacePlacement.WithinExpressionParentheses) ?
SpacePlacementWithinParentheses
.Expressions : 0) |
23
(placement.HasFlag(SpacePlacement.WithinCastParentheses) ?
SpacePlacementWithinParentheses
.TypeCasts : 0) |
24
(placement.HasFlag(SpacePlacement.WithinOtherParentheses) ?
SpacePlacementWithinParentheses
.ControlFlowStatements : 0);
26
public static SpacePlacement ToSpacePlacement(this
SpacePlacementWithinParentheses
placement)
27
=> (placement.HasFlag(
SpacePlacementWithinParentheses
.Expressions) ? SpacePlacement.WithinExpressionParentheses : 0) |
28
(placement.HasFlag(
SpacePlacementWithinParentheses
.TypeCasts) ? SpacePlacement.WithinCastParentheses : 0) |
29
(placement.HasFlag(
SpacePlacementWithinParentheses
.ControlFlowStatements) ? SpacePlacement.WithinOtherParentheses : 0);
31
public static
SpacePlacementWithinParentheses
WithFlagValue(this
SpacePlacementWithinParentheses
flags,
SpacePlacementWithinParentheses
flag, bool value)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (24)
Formatting\EditorConfigOptionParserTests.cs (21)
13
[InlineData("expressions",
SpacePlacementWithinParentheses
.Expressions, "expressions")]
14
[InlineData("type_casts",
SpacePlacementWithinParentheses
.TypeCasts, "type_casts")]
15
[InlineData("control_flow_statements",
SpacePlacementWithinParentheses
.ControlFlowStatements, "control_flow_statements")]
16
[InlineData("false",
SpacePlacementWithinParentheses
.None, "false")]
17
[InlineData("",
SpacePlacementWithinParentheses
.None, "false")]
18
[InlineData(",,,",
SpacePlacementWithinParentheses
.None, "false")]
19
[InlineData("*",
SpacePlacementWithinParentheses
.None, "false")]
20
[InlineData("expressions, type_casts",
SpacePlacementWithinParentheses
.Expressions |
SpacePlacementWithinParentheses
.TypeCasts, "expressions,type_casts")]
21
[InlineData("type_casts, expressions, , ",
SpacePlacementWithinParentheses
.Expressions |
SpacePlacementWithinParentheses
.TypeCasts, "expressions,type_casts")]
22
[InlineData("expressions , , , control_flow_statements",
SpacePlacementWithinParentheses
.Expressions |
SpacePlacementWithinParentheses
.ControlFlowStatements, "expressions,control_flow_statements")]
23
[InlineData("expressions , , type_casts , control_flow_statements, type_casts",
SpacePlacementWithinParentheses
.Expressions |
SpacePlacementWithinParentheses
.ControlFlowStatements |
SpacePlacementWithinParentheses
.TypeCasts, "expressions,type_casts,control_flow_statements")]
24
[InlineData(", , x , control_flow_statements",
SpacePlacementWithinParentheses
.ControlFlowStatements, "control_flow_statements")]
25
[InlineData("none,expressions",
SpacePlacementWithinParentheses
.Expressions, "expressions")]
26
[InlineData("all,expressions",
SpacePlacementWithinParentheses
.Expressions, "expressions")]
27
[InlineData("false,expressions",
SpacePlacementWithinParentheses
.Expressions, "expressions")]
28
internal void TestParseSpacingWithinParenthesesList(string list,
SpacePlacementWithinParentheses
value, string roundtrip)
Formatting\FormattingTests.cs (1)
6122
{ SpaceBetweenParentheses, SpaceBetweenParentheses.DefaultValue.WithFlagValue(
SpacePlacementWithinParentheses
.ControlFlowStatements, true) },
Formatting\FormattingTests_Patterns.cs (2)
165
{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(
SpacePlacementWithinParentheses
.Expressions, spaceWithinExpressionParentheses) },
312
{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(
SpacePlacementWithinParentheses
.Expressions, spaceWithinExpressionParentheses) },
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
Options\DocumentOptionSetTests.cs (4)
158
(CSharpFormattingOptions.SpaceWithinExpressionParentheses,
SpacePlacementWithinParentheses
.Expressions),
159
(CSharpFormattingOptions.SpaceWithinCastParentheses,
SpacePlacementWithinParentheses
.TypeCasts),
160
(CSharpFormattingOptions.SpaceWithinOtherParentheses,
SpacePlacementWithinParentheses
.ControlFlowStatements),
167
var
newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (29)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (6)
23
private static readonly Conversions<
SpacePlacementWithinParentheses
, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (
SpacePlacementWithinParentheses
)v);
55
var spaceBetweenParenthesesValue = new StrongBox<
SpacePlacementWithinParentheses
>();
56
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService);
57
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService);
58
yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.ControlFlowStatements, CSharpVSResources.Insert_spaces_within_parentheses_of_control_flow_statements, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService);
Options\AutomationObject\AutomationObject.cs (4)
30
private int GetBooleanOption(Option2<
SpacePlacementWithinParentheses
> option,
SpacePlacementWithinParentheses
flag)
42
private void SetBooleanOption(Option2<
SpacePlacementWithinParentheses
> option,
SpacePlacementWithinParentheses
flag, int value)
Options\AutomationObject\AutomationObject.Formatting.cs (6)
248
get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.TypeCasts); }
249
set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.TypeCasts, value); }
254
get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.Expressions); }
255
set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.Expressions, value); }
260
get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.ControlFlowStatements); }
261
set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses,
SpacePlacementWithinParentheses
.ControlFlowStatements, value); }
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (4)
26
("TextEditor.CSharp.Specific.SpaceWithinExpressionParentheses", (int)
SpacePlacementWithinParentheses
.Expressions),
27
("TextEditor.CSharp.Specific.SpaceWithinCastParentheses", (int)
SpacePlacementWithinParentheses
.TypeCasts),
28
("TextEditor.CSharp.Specific.SpaceWithinOtherParentheses", (int)
SpacePlacementWithinParentheses
.ControlFlowStatements));
37
=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue, readValue, out var intValue) ? (
SpacePlacementWithinParentheses
)intValue : default(Optional<object?>);
Options\Formatting\SpacingViewModel.cs (9)
22
private static readonly Conversions<
SpacePlacementWithinParentheses
, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (
SpacePlacementWithinParentheses
)v);
127
var spaceBetweenParenthesesStorage = new StrongBox<
SpacePlacementWithinParentheses
>();
128
Items.Add(new CheckBoxEnumFlagsOptionViewModel<
SpacePlacementWithinParentheses
>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, s_expressionPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions));
129
Items.Add(new CheckBoxEnumFlagsOptionViewModel<
SpacePlacementWithinParentheses
>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, s_castPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions));
130
Items.Add(new CheckBoxEnumFlagsOptionViewModel<
SpacePlacementWithinParentheses
>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)
SpacePlacementWithinParentheses
.ControlFlowStatements, CSharpVSResources.Insert_spaces_within_parentheses_of_control_flow_statements, s_forDelimiterPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions));
Roslyn.VisualStudio.Next.UnitTests (3)
Options\VisualStudioStorageReadFallbackTests.cs (3)
28
Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value,
SpacePlacementWithinParentheses
.All);
33
CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue & ~
SpacePlacementWithinParentheses
.Expressions);
38
CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue |
SpacePlacementWithinParentheses
.Expressions);