91 references to SpacePlacementWithinParentheses
Microsoft.CodeAnalysis.CSharp.Workspaces (31)
CSharpFormattingOptions2.cs (6)
26private static readonly BidirectionalMap<string, SpacePlacementWithinParentheses> s_spacingWithinParenthesisOptionsEditorConfigMap = 29KeyValuePairUtil.Create("expressions", SpacePlacementWithinParentheses.Expressions), 30KeyValuePairUtil.Create("type_casts", SpacePlacementWithinParentheses.TypeCasts), 31KeyValuePairUtil.Create("control_flow_statements", SpacePlacementWithinParentheses.ControlFlowStatements), 112public static Option2<SpacePlacementWithinParentheses> SpaceBetweenParentheses { get; } = CreateOption( 116new EditorConfigValueSerializer<SpacePlacementWithinParentheses>(
CSharpFormattingOptions2.Parsers.cs (6)
69internal static SpacePlacementWithinParentheses ParseSpacingWithinParenthesesList(string list) 70=> (SpacePlacementWithinParentheses)ParseEditorConfigFlags(list, static s => s_spacingWithinParenthesisOptionsEditorConfigMap.TryGetValue(s, out var v) ? (int)v : 0); 72internal static string ToEditorConfigValue(SpacePlacementWithinParentheses value) 73=> (value == SpacePlacementWithinParentheses.None) ? "false" : 74ToEditorConfigFlagList((int)value, static v => s_spacingWithinParenthesisOptionsEditorConfigMap[(SpacePlacementWithinParentheses)v]);
Formatting\CSharpFormattingOptions.cs (8)
28private static Option<bool> CreateSpaceWithinOption(string publicName, SpacePlacementWithinParentheses flag) 57private readonly SpacePlacementWithinParentheses _flag; 59public SpacePlacementInternalStorageMapping(IOption2 internalOption, SpacePlacementWithinParentheses flag) 66=> ((SpacePlacementWithinParentheses)internalValue!).HasFlag(_flag); 69=> ((SpacePlacementWithinParentheses)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!); 93public static Option<bool> SpaceWithinExpressionParentheses { get; } = CreateSpaceWithinOption("SpaceWithinExpressionParentheses", SpacePlacementWithinParentheses.Expressions); 94public static Option<bool> SpaceWithinCastParentheses { get; } = CreateSpaceWithinOption("SpaceWithinCastParentheses", SpacePlacementWithinParentheses.TypeCasts); 95public static Option<bool> SpaceWithinOtherParentheses { get; } = CreateSpaceWithinOption("SpaceWithinOtherParentheses", SpacePlacementWithinParentheses.ControlFlowStatements);
SpacingWithinParentheses.cs (11)
21public 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); 26public 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); 31public 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")] 28internal 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), 167var newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (29)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (6)
23private static readonly Conversions<SpacePlacementWithinParentheses, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (SpacePlacementWithinParentheses)v); 55var spaceBetweenParenthesesValue = new StrongBox<SpacePlacementWithinParentheses>(); 56yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService); 57yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService); 58yield 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)
30private int GetBooleanOption(Option2<SpacePlacementWithinParentheses> option, SpacePlacementWithinParentheses flag) 42private void SetBooleanOption(Option2<SpacePlacementWithinParentheses> option, SpacePlacementWithinParentheses flag, int value)
Options\AutomationObject\AutomationObject.Formatting.cs (6)
248get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses, SpacePlacementWithinParentheses.TypeCasts); } 249set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses, SpacePlacementWithinParentheses.TypeCasts, value); } 254get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses, SpacePlacementWithinParentheses.Expressions); } 255set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses, SpacePlacementWithinParentheses.Expressions, value); } 260get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenParentheses, SpacePlacementWithinParentheses.ControlFlowStatements); } 261set { 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)
22private static readonly Conversions<SpacePlacementWithinParentheses, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (SpacePlacementWithinParentheses)v); 127var spaceBetweenParenthesesStorage = new StrongBox<SpacePlacementWithinParentheses>(); 128Items.Add(new CheckBoxEnumFlagsOptionViewModel<SpacePlacementWithinParentheses>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, s_expressionPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions)); 129Items.Add(new CheckBoxEnumFlagsOptionViewModel<SpacePlacementWithinParentheses>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, s_castPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions)); 130Items.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)
28Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value, SpacePlacementWithinParentheses.All); 33CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue & ~SpacePlacementWithinParentheses.Expressions); 38CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue | SpacePlacementWithinParentheses.Expressions);