91 references to SpacePlacementWithinParentheses
Microsoft.CodeAnalysis.CSharp.Workspaces (31)
Formatting\CSharpFormattingOptions.cs (8)
27private static Option<bool> CreateSpaceWithinOption(string publicName, SpacePlacementWithinParentheses flag) 56private readonly SpacePlacementWithinParentheses _flag; 58public SpacePlacementInternalStorageMapping(IOption2 internalOption, SpacePlacementWithinParentheses flag) 65=> ((SpacePlacementWithinParentheses)internalValue!).HasFlag(_flag); 68=> ((SpacePlacementWithinParentheses)currentInternalValue!).WithFlagValue(_flag, (bool)newPublicValue!); 92public static Option<bool> SpaceWithinExpressionParentheses { get; } = CreateSpaceWithinOption("SpaceWithinExpressionParentheses", SpacePlacementWithinParentheses.Expressions); 93public static Option<bool> SpaceWithinCastParentheses { get; } = CreateSpaceWithinOption("SpaceWithinCastParentheses", SpacePlacementWithinParentheses.TypeCasts); 94public static Option<bool> SpaceWithinOtherParentheses { get; } = CreateSpaceWithinOption("SpaceWithinOtherParentheses", SpacePlacementWithinParentheses.ControlFlowStatements);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpFormattingOptions2.cs (6)
21private static readonly BidirectionalMap<string, SpacePlacementWithinParentheses> s_spacingWithinParenthesisOptionsEditorConfigMap = 24KeyValuePair.Create("expressions", SpacePlacementWithinParentheses.Expressions), 25KeyValuePair.Create("type_casts", SpacePlacementWithinParentheses.TypeCasts), 26KeyValuePair.Create("control_flow_statements", SpacePlacementWithinParentheses.ControlFlowStatements), 105public static Option2<SpacePlacementWithinParentheses> SpaceBetweenParentheses { get; } = CreateOption( 109new EditorConfigValueSerializer<SpacePlacementWithinParentheses>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\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]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\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)
6363{ SpaceBetweenParentheses, SpaceBetweenParentheses.DefaultValue.WithFlagValue( SpacePlacementWithinParentheses.ControlFlowStatements, true) },
Formatting\FormattingTests_Patterns.cs (2)
150{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(SpacePlacementWithinParentheses.Expressions, spaceWithinExpressionParentheses) }, 291{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(SpacePlacementWithinParentheses.Expressions, spaceWithinExpressionParentheses) },
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
Options\DocumentOptionSetTests.cs (4)
159(CSharpFormattingOptions.SpaceWithinExpressionParentheses, SpacePlacementWithinParentheses.Expressions), 160(CSharpFormattingOptions.SpaceWithinCastParentheses, SpacePlacementWithinParentheses.TypeCasts), 161(CSharpFormattingOptions.SpaceWithinOtherParentheses, SpacePlacementWithinParentheses.ControlFlowStatements), 168var newInternalValue = option.DefaultValue.WithFlagValue(flag, newValue);
Microsoft.VisualStudio.LanguageServices.CSharp (29)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (6)
19private static readonly Conversions<SpacePlacementWithinParentheses, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (SpacePlacementWithinParentheses)v); 51var spaceBetweenParenthesesValue = new StrongBox<SpacePlacementWithinParentheses>(); 52yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService); 53yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, spaceBetweenParenthesesValue, s_spaceBetweenParenthesesConversions, options, updaterService); 54yield 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)
22("TextEditor.CSharp.Specific.SpaceWithinExpressionParentheses", (int)SpacePlacementWithinParentheses.Expressions), 23("TextEditor.CSharp.Specific.SpaceWithinCastParentheses", (int)SpacePlacementWithinParentheses.TypeCasts), 24("TextEditor.CSharp.Specific.SpaceWithinOtherParentheses", (int)SpacePlacementWithinParentheses.ControlFlowStatements), 34=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue, readValue, out var intValue) ? (SpacePlacementWithinParentheses)intValue : default(Optional<object?>);
Options\Formatting\SpacingViewModel.cs (9)
21private static readonly Conversions<SpacePlacementWithinParentheses, int> s_spaceBetweenParenthesesConversions = new(v => (int)v, v => (SpacePlacementWithinParentheses)v); 142var spaceBetweenParenthesesStorage = new StrongBox<SpacePlacementWithinParentheses>(); 143Items.Add(new CheckBoxEnumFlagsOptionViewModel<SpacePlacementWithinParentheses>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.Expressions, CSharpVSResources.Insert_space_within_parentheses_of_expressions, s_expressionPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions)); 144Items.Add(new CheckBoxEnumFlagsOptionViewModel<SpacePlacementWithinParentheses>(CSharpFormattingOptions2.SpaceBetweenParentheses, (int)SpacePlacementWithinParentheses.TypeCasts, CSharpVSResources.Insert_space_within_parentheses_of_type_casts, s_castPreview, this, optionStore, spaceBetweenParenthesesStorage, s_spaceBetweenParenthesesConversions)); 145Items.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)
29Assert.Equal(fallback.TryRead(language, (_, _, _) => true).Value, SpacePlacementWithinParentheses.All); 34CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue & ~SpacePlacementWithinParentheses.Expressions); 39CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue | SpacePlacementWithinParentheses.Expressions);