442 references to CSharpFormattingOptions2
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (37)
AutomaticCompletion\AutomaticBraceCompletionTests.cs (24)
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) }
ChangeSignature\AddParameterTests.Formatting.cs (1)
512options: Option(CSharpFormattingOptions2.IndentBraces, true));
CodeActions\InitializeParameter\InitializeMemberFromParameterTests.cs (1)
1550""", new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Methods)));
CodeActions\InitializeParameter\InitializeMemberFromPrimaryConstructorParameterTests.cs (1)
979""", new(options: this.Option(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Types)));
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (10)
86(CSharpFormattingOptions2.NewLineForElse, true)); 143(CSharpFormattingOptions2.NewLineForElse, false)); 168(CSharpFormattingOptions2.NewLineForElse, true)); 191(CSharpFormattingOptions2.NewLineForElse, true)); 225(CSharpFormattingOptions2.NewLineForElse, true)); 232(CSharpFormattingOptions2.NewLineForElse, true), 233(CSharpFormattingOptions2.NewLineForCatch, true), 234(CSharpFormattingOptions2.NewLineForFinally, true)); 308(CSharpFormattingOptions2.NewLineForElse, true)); 373var setting = Setting.Create(CSharpFormattingOptions2.NewLineForElse, "description", options, updater);
Microsoft.CodeAnalysis.CSharp.Features (3)
Options\CSharpEditorConfigOptionsEnumerator.cs (2)
29yield return (CSharpWorkspaceResources.CSharp_Formatting_Rules, CSharpFormattingOptions2.EditorConfigOptions); 33yield return (CSharpWorkspaceResources.CSharp_Formatting_Rules, CSharpFormattingOptions2.UndocumentedOptions);
Wrapping\CSharpSyntaxWrappingOptions.cs (1)
26newLinesForBracesInObjectCollectionArrayInitializers: options.GetOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace).HasFlag(NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (5)
ConvertAutoPropertyToFullProperty\ConvertAutoPropertyToFullPropertyTests_OptionSets.cs (2)
34{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Properties }, 41{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.All & ~NewLineBeforeOpenBracePlacement.Accessors },
src\Analyzers\CSharp\Tests\ConvertNamespace\ConvertToBlockScopedNamespaceAnalyzerTests.cs (2)
256{ CSharpFormattingOptions2.NewLineBeforeOpenBrace, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.Types },
src\Analyzers\CSharp\Tests\InlineDeclaration\CSharpInlineDeclarationTests.cs (1)
2467{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, ignoreSpacing },
Microsoft.CodeAnalysis.CSharp.Workspaces (113)
Formatting\CSharpFormattingOptions.cs (75)
12/// <inheritdoc cref="CSharpFormattingOptions2"/> 22defaultValue: CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue.HasFlag(flag), 24storageMapping: new NewLineForBracesInternalStorageMapping(CSharpFormattingOptions2.NewLineBeforeOpenBrace, flag), 32defaultValue: CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.HasFlag(flag), 34storageMapping: new SpacePlacementInternalStorageMapping(CSharpFormattingOptions2.SpaceBetweenParentheses, flag), 71/// <inheritdoc cref="CSharpFormattingOptions2.SpacingAfterMethodDeclarationName"/> 72public static Option<bool> SpacingAfterMethodDeclarationName { get; } = CSharpFormattingOptions2.SpacingAfterMethodDeclarationName.ToPublicOption(); 74/// <inheritdoc cref="CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis"/> 75public static Option<bool> SpaceWithinMethodDeclarationParenthesis { get; } = CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis.ToPublicOption(); 77/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses"/> 78public static Option<bool> SpaceBetweenEmptyMethodDeclarationParentheses { get; } = CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses.ToPublicOption(); 80/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterMethodCallName"/> 81public static Option<bool> SpaceAfterMethodCallName { get; } = CSharpFormattingOptions2.SpaceAfterMethodCallName.ToPublicOption(); 83/// <inheritdoc cref="CSharpFormattingOptions2.SpaceWithinMethodCallParentheses"/> 84public static Option<bool> SpaceWithinMethodCallParentheses { get; } = CSharpFormattingOptions2.SpaceWithinMethodCallParentheses.ToPublicOption(); 86/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses"/> 87public static Option<bool> SpaceBetweenEmptyMethodCallParentheses { get; } = CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses.ToPublicOption(); 89/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword"/> 90public static Option<bool> SpaceAfterControlFlowStatementKeyword { get; } = CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword.ToPublicOption(); 96/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterCast"/> 97public static Option<bool> SpaceAfterCast { get; } = CSharpFormattingOptions2.SpaceAfterCast.ToPublicOption(); 99/// <inheritdoc cref="CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration"/> 100public static Option<bool> SpacesIgnoreAroundVariableDeclaration { get; } = CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration.ToPublicOption(); 102/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket"/> 103public static Option<bool> SpaceBeforeOpenSquareBracket { get; } = CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket.ToPublicOption(); 105/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets"/> 106public static Option<bool> SpaceBetweenEmptySquareBrackets { get; } = CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets.ToPublicOption(); 108/// <inheritdoc cref="CSharpFormattingOptions2.SpaceWithinSquareBrackets"/> 109public static Option<bool> SpaceWithinSquareBrackets { get; } = CSharpFormattingOptions2.SpaceWithinSquareBrackets.ToPublicOption(); 111/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration"/> 112public static Option<bool> SpaceAfterColonInBaseTypeDeclaration { get; } = CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration.ToPublicOption(); 114/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterComma"/> 115public static Option<bool> SpaceAfterComma { get; } = CSharpFormattingOptions2.SpaceAfterComma.ToPublicOption(); 117/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterDot"/> 118public static Option<bool> SpaceAfterDot { get; } = CSharpFormattingOptions2.SpaceAfterDot.ToPublicOption(); 120/// <inheritdoc cref="CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement"/> 121public static Option<bool> SpaceAfterSemicolonsInForStatement { get; } = CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement.ToPublicOption(); 123/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration"/> 124public static Option<bool> SpaceBeforeColonInBaseTypeDeclaration { get; } = CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration.ToPublicOption(); 126/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBeforeComma"/> 127public static Option<bool> SpaceBeforeComma { get; } = CSharpFormattingOptions2.SpaceBeforeComma.ToPublicOption(); 129/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBeforeDot"/> 130public static Option<bool> SpaceBeforeDot { get; } = CSharpFormattingOptions2.SpaceBeforeDot.ToPublicOption(); 132/// <inheritdoc cref="CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement"/> 133public static Option<bool> SpaceBeforeSemicolonsInForStatement { get; } = CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement.ToPublicOption(); 135/// <inheritdoc cref="CSharpFormattingOptions2.SpacingAroundBinaryOperator"/> 137CSharpFormattingOptions2.SpacingAroundBinaryOperator.ToPublicOption().ConvertEnumOption<BinaryOperatorSpacingOptionsInternal, BinaryOperatorSpacingOptions>(); 139/// <inheritdoc cref="CSharpFormattingOptions2.IndentBraces"/> 140public static Option<bool> IndentBraces { get; } = CSharpFormattingOptions2.IndentBraces.ToPublicOption(); 142/// <inheritdoc cref="CSharpFormattingOptions2.IndentBlock"/> 143public static Option<bool> IndentBlock { get; } = CSharpFormattingOptions2.IndentBlock.ToPublicOption(); 145/// <inheritdoc cref="CSharpFormattingOptions2.IndentSwitchSection"/> 146public static Option<bool> IndentSwitchSection { get; } = CSharpFormattingOptions2.IndentSwitchSection.ToPublicOption(); 148/// <inheritdoc cref="CSharpFormattingOptions2.IndentSwitchCaseSection"/> 149public static Option<bool> IndentSwitchCaseSection { get; } = CSharpFormattingOptions2.IndentSwitchCaseSection.ToPublicOption(); 151/// <inheritdoc cref="CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock"/> 152public static Option<bool> IndentSwitchCaseSectionWhenBlock { get; } = CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock.ToPublicOption(); 154/// <inheritdoc cref="CSharpFormattingOptions2.LabelPositioning"/> 156CSharpFormattingOptions2.LabelPositioning.ToPublicOption().ConvertEnumOption<LabelPositionOptionsInternal, LabelPositionOptions>(); 158/// <inheritdoc cref="CSharpFormattingOptions2.WrappingPreserveSingleLine"/> 159public static Option<bool> WrappingPreserveSingleLine { get; } = CSharpFormattingOptions2.WrappingPreserveSingleLine.ToPublicOption(); 161/// <inheritdoc cref="CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine"/> 162public static Option<bool> WrappingKeepStatementsOnSingleLine { get; } = CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine.ToPublicOption(); 174/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForElse"/> 175public static Option<bool> NewLineForElse { get; } = CSharpFormattingOptions2.NewLineForElse.ToPublicOption(); 177/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForCatch"/> 178public static Option<bool> NewLineForCatch { get; } = CSharpFormattingOptions2.NewLineForCatch.ToPublicOption(); 180/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForFinally"/> 181public static Option<bool> NewLineForFinally { get; } = CSharpFormattingOptions2.NewLineForFinally.ToPublicOption(); 183/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForMembersInObjectInit"/> 184public static Option<bool> NewLineForMembersInObjectInit { get; } = CSharpFormattingOptions2.NewLineForMembersInObjectInit.ToPublicOption(); 186/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes"/> 187public static Option<bool> NewLineForMembersInAnonymousTypes { get; } = CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes.ToPublicOption(); 189/// <inheritdoc cref="CSharpFormattingOptions2.NewLineForClausesInQuery"/> 190public static Option<bool> NewLineForClausesInQuery { get; } = CSharpFormattingOptions2.NewLineForClausesInQuery.ToPublicOption();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpSyntaxFormattingOptions.cs (38)
74(options.GetOption(CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration) ? SpacePlacement.IgnoreAroundVariableDeclaration : 0) | 75(options.GetOption(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName) ? SpacePlacement.AfterMethodDeclarationName : 0) | 76(options.GetOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses) ? SpacePlacement.BetweenEmptyMethodDeclarationParentheses : 0) | 77(options.GetOption(CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis) ? SpacePlacement.WithinMethodDeclarationParenthesis : 0) | 78(options.GetOption(CSharpFormattingOptions2.SpaceAfterMethodCallName) ? SpacePlacement.AfterMethodCallName : 0) | 79(options.GetOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses) ? SpacePlacement.BetweenEmptyMethodCallParentheses : 0) | 80(options.GetOption(CSharpFormattingOptions2.SpaceWithinMethodCallParentheses) ? SpacePlacement.WithinMethodCallParentheses : 0) | 81(options.GetOption(CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword) ? SpacePlacement.AfterControlFlowStatementKeyword : 0) | 82options.GetOption(CSharpFormattingOptions2.SpaceBetweenParentheses).ToSpacePlacement() | 83(options.GetOption(CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement) ? SpacePlacement.BeforeSemicolonsInForStatement : 0) | 84(options.GetOption(CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement) ? SpacePlacement.AfterSemicolonsInForStatement : 0) | 85(options.GetOption(CSharpFormattingOptions2.SpaceAfterCast) ? SpacePlacement.AfterCast : 0) | 86(options.GetOption(CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket) ? SpacePlacement.BeforeOpenSquareBracket : 0) | 87(options.GetOption(CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets) ? SpacePlacement.BetweenEmptySquareBrackets : 0) | 88(options.GetOption(CSharpFormattingOptions2.SpaceWithinSquareBrackets) ? SpacePlacement.WithinSquareBrackets : 0) | 89(options.GetOption(CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration) ? SpacePlacement.AfterColonInBaseTypeDeclaration : 0) | 90(options.GetOption(CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration) ? SpacePlacement.BeforeColonInBaseTypeDeclaration : 0) | 91(options.GetOption(CSharpFormattingOptions2.SpaceAfterComma) ? SpacePlacement.AfterComma : 0) | 92(options.GetOption(CSharpFormattingOptions2.SpaceBeforeComma) ? SpacePlacement.BeforeComma : 0) | 93(options.GetOption(CSharpFormattingOptions2.SpaceAfterDot) ? SpacePlacement.AfterDot : 0) | 94(options.GetOption(CSharpFormattingOptions2.SpaceBeforeDot) ? SpacePlacement.BeforeDot : 0); 95SpacingAroundBinaryOperator = options.GetOption(CSharpFormattingOptions2.SpacingAroundBinaryOperator); 97(options.GetOption(CSharpFormattingOptions2.NewLineForMembersInObjectInit) ? NewLinePlacement.BeforeMembersInObjectInitializers : 0) | 98(options.GetOption(CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes) ? NewLinePlacement.BeforeMembersInAnonymousTypes : 0) | 99(options.GetOption(CSharpFormattingOptions2.NewLineForElse) ? NewLinePlacement.BeforeElse : 0) | 100(options.GetOption(CSharpFormattingOptions2.NewLineForCatch) ? NewLinePlacement.BeforeCatch : 0) | 101(options.GetOption(CSharpFormattingOptions2.NewLineForFinally) ? NewLinePlacement.BeforeFinally : 0) | 102options.GetOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace).ToNewLinePlacement() | 103(options.GetOption(CSharpFormattingOptions2.NewLineForClausesInQuery) ? NewLinePlacement.BetweenQueryExpressionClauses : 0); 104LabelPositioning = options.GetOption(CSharpFormattingOptions2.LabelPositioning); 106(options.GetOption(CSharpFormattingOptions2.IndentBraces) ? IndentationPlacement.Braces : 0) | 107(options.GetOption(CSharpFormattingOptions2.IndentBlock) ? IndentationPlacement.BlockContents : 0) | 108(options.GetOption(CSharpFormattingOptions2.IndentSwitchCaseSection) ? IndentationPlacement.SwitchCaseContents : 0) | 109(options.GetOption(CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock) ? IndentationPlacement.SwitchCaseContentsWhenBlock : 0) | 110(options.GetOption(CSharpFormattingOptions2.IndentSwitchSection) ? IndentationPlacement.SwitchSection : 0); 111WrappingKeepStatementsOnSingleLine = options.GetOption(CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine); 112WrappingPreserveSingleLine = options.GetOption(CSharpFormattingOptions2.WrappingPreserveSingleLine); 115CollectionExpressionWrappingLength = options.GetOption(CSharpFormattingOptions2.CollectionExpressionWrappingLength);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (70)
CodeStyle\CSharpEditorConfigCodeStyleParserTests.cs (2)
28=> Assert.Equal(parsedValue, (BinaryOperatorSpacingOptions)CSharpFormattingOptions2.ParseEditorConfigSpacingAroundBinaryOperator(rawValue)); 40=> Assert.Equal(parsedValue, (LabelPositionOptions)CSharpFormattingOptions2.ParseEditorConfigLabelPositioning(rawValue));
Formatting\EditorConfigOptionParserTests.cs (10)
30Assert.Equal(value, CSharpFormattingOptions2.ParseSpacingWithinParenthesesList(list)); 31Assert.Equal(roundtrip, CSharpFormattingOptions2.ToEditorConfigValue(value)); 39=> Assert.True(CSharpFormattingOptions2.ParseEditorConfigSpacingAroundBinaryOperator(value) == (BinaryOperatorSpacingOptionsInternal)expectedResult, 47=> Assert.True(CSharpFormattingOptions2.ParseEditorConfigSpacingAroundBinaryOperator(value) == BinaryOperatorSpacingOptionsInternal.Single, 55=> Assert.True(CSharpFormattingOptions2.ParseEditorConfigLabelPositioning(value) == (LabelPositionOptionsInternal)expectedValue, 63=> Assert.True(CSharpFormattingOptions2.ParseEditorConfigLabelPositioning(value) == LabelPositionOptionsInternal.NoIndent, 98Assert.Equal(value, CSharpFormattingOptions2.ParseNewLineBeforeOpenBracePlacementList(list)); 99Assert.Equal(roundtrip, CSharpFormattingOptions2.ToEditorConfigValue(value)); 108=> Assert.True(CSharpFormattingOptions2.DetermineIfIgnoreSpacesAroundVariableDeclarationIsSet(value), 116=> Assert.False(CSharpFormattingOptions2.DetermineIfIgnoreSpacesAroundVariableDeclarationIsSet(value),
Formatting\FormattingMultipleSpanTests.cs (2)
101{ CSharpFormattingOptions2.IndentBlock, false } 127{ CSharpFormattingOptions2.WrappingPreserveSingleLine, false }
Formatting\FormattingTests.cs (48)
15using static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions2; 1020{ CSharpFormattingOptions2.SpacingAroundBinaryOperator, BinaryOperatorSpacingOptions.Remove } 1571{ CSharpFormattingOptions2.WrappingPreserveSingleLine, false } 1646{ CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false } 1717{ CSharpFormattingOptions2.WrappingPreserveSingleLine, false }, 1718{ CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false } 1803{ CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false } 2154{ CSharpFormattingOptions2.NewLineForElse, false }, 2155{ CSharpFormattingOptions2.NewLineForCatch, false }, 2156{ CSharpFormattingOptions2.NewLineForFinally, false } 2329{ CSharpFormattingOptions2.NewLineForMembersInObjectInit, false }, 2330{ CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes, false }, 2331{ CSharpFormattingOptions2.NewLineForClausesInQuery, false } 5395{ CSharpFormattingOptions2.SpaceAfterMethodCallName, true } 5419{ CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, true } 5445{ CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, true } 5471{ CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, true } 6185{ CSharpFormattingOptions2.LabelPositioning, LabelPositionOptions.LeftMost } 6459var optionSet = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword, false } }; 6570var optionSet = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.SpaceAfterComma, false } }; 6582optionSet.Add(CSharpFormattingOptions2.SpaceBeforeComma, true); 6694{ CSharpFormattingOptions2.NewLineForElse, false } 6922var options = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.WrappingPreserveSingleLine, false } }; 6941var options = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.WrappingPreserveSingleLine, false } }; 6959var options = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false } }; 7515{ CSharpFormattingOptions2.SpaceWithinSquareBrackets, true }, 7516{ CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets, false } 7536var options = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket, true } }; 7555var options = new OptionsCollection(LanguageNames.CSharp) { { CSharpFormattingOptions2.SpaceWithinSquareBrackets, true } }; 7692{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, true } 8420{ CSharpFormattingOptions2.SpaceAfterMethodCallName, true }, 8421{ CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, true }, 8422{ CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, true } 8463{ CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, true }, 8464{ CSharpFormattingOptions2.SpaceAfterMethodCallName, true }, 8465{ CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, true }, 8573{ CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement, false }, 8606{ CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement, true }, 8607{ CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement, false }, 8640{ CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement, true }, 8695{ CSharpFormattingOptions2.SpacingAfterMethodDeclarationName, true } 9110{ CSharpFormattingOptions2.WrappingPreserveSingleLine, true }, 9111{ CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false}, 9774{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, true } 9804{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, true }, 9805{ CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, false } 9911{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, true } 9937{ CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, false }
Formatting\FormattingTests_Patterns.cs (8)
62{ CSharpFormattingOptions2.SpacingAroundBinaryOperator, spacing }, 149{ CSharpFormattingOptions2.SpacingAroundBinaryOperator, spacing }, 150{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(SpacePlacementWithinParentheses.Expressions, spaceWithinExpressionParentheses) }, 204{ CSharpFormattingOptions2.SpacingAroundBinaryOperator, spacing }, 290{ CSharpFormattingOptions2.SpacingAroundBinaryOperator, spacing }, 291{ CSharpFormattingOptions2.SpaceBetweenParentheses, CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue.WithFlagValue(SpacePlacementWithinParentheses.Expressions, spaceWithinExpressionParentheses) },
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
Options\DocumentOptionSetTests.cs (2)
93var option = CSharpFormattingOptions2.NewLineBeforeOpenBrace; 155var option = CSharpFormattingOptions2.SpaceBetweenParentheses;
Options\OptionKeyTests.cs (2)
185Assert.All(CSharpFormattingOptions2.EditorConfigOptions, o => Assert.True(o.Definition.IsEditorConfigOption)); 186Assert.All(CSharpFormattingOptions2.UndocumentedOptions, o => Assert.True(o.Definition.IsEditorConfigOption));
Microsoft.VisualStudio.LanguageServices.CSharp (198)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (47)
42yield return Setting.Create(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName, CSharpVSResources.Insert_space_between_method_name_and_its_opening_parenthesis, options, updaterService); 43yield return Setting.Create(CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis, CSharpVSResources.Insert_space_within_parameter_list_parentheses, options, updaterService); 44yield return Setting.Create(CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses, CSharpVSResources.Insert_space_within_empty_parameter_list_parentheses, options, updaterService); 45yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterMethodCallName, CSharpVSResources.Insert_space_between_called_method_name_and_its_opening_parenthesis, options, updaterService); 46yield return Setting.Create(CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, CSharpVSResources.Insert_space_within_argument_list_parentheses, options, updaterService); 47yield return Setting.Create(CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, CSharpVSResources.Insert_space_within_empty_argument_list_parentheses, options, updaterService); 49yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword, CSharpVSResources.Insert_space_after_keywords_in_control_flow_statements, options, updaterService); 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); 56yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterCast, CSharpVSResources.Insert_space_after_cast, options, updaterService); 57yield return Setting.Create(CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, CSharpVSResources.Ignore_spaces_in_declaration_statements, options, updaterService); 59yield return Setting.Create(CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket, CSharpVSResources.Insert_space_before_open_square_bracket, options, updaterService); 60yield return Setting.Create(CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets, CSharpVSResources.Insert_space_within_empty_square_brackets, options, updaterService); 61yield return Setting.Create(CSharpFormattingOptions2.SpaceWithinSquareBrackets, CSharpVSResources.Insert_spaces_within_square_brackets, options, updaterService); 63yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration, CSharpVSResources.Insert_space_after_colon_for_base_or_interface_in_type_declaration, options, updaterService); 64yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterComma, CSharpVSResources.Insert_space_after_comma, options, updaterService); 65yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterDot, CSharpVSResources.Insert_space_after_dot, options, updaterService); 66yield return Setting.Create(CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement, CSharpVSResources.Insert_space_after_semicolon_in_for_statement, options, updaterService); 67yield return Setting.Create(CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration, CSharpVSResources.Insert_space_before_colon_for_base_or_interface_in_type_declaration, options, updaterService); 68yield return Setting.Create(CSharpFormattingOptions2.SpaceBeforeComma, CSharpVSResources.Insert_space_before_comma, options, updaterService); 69yield return Setting.Create(CSharpFormattingOptions2.SpaceBeforeDot, CSharpVSResources.Insert_space_before_dot, options, updaterService); 70yield return Setting.Create(CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement, CSharpVSResources.Insert_space_before_semicolon_in_for_statement, options, updaterService); 72yield return Setting.Create(CSharpFormattingOptions2.SpacingAroundBinaryOperator, CSharpVSResources.Set_spacing_for_operators, options, updaterService); 78yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Types, CSharpVSResources.Place_open_brace_on_new_line_for_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 79yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.Methods, CSharpVSResources.Place_open_brace_on_new_line_for_methods_local_functions, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 80yield 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); 81yield 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); 82yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousMethods, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_methods, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 83yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.ControlBlocks, CSharpVSResources.Place_open_brace_on_new_line_for_control_blocks, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 84yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.AnonymousTypes, CSharpVSResources.Place_open_brace_on_new_line_for_anonymous_types, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 85yield 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); 86yield return Setting.CreateEnumFlags(CSharpFormattingOptions2.NewLineBeforeOpenBrace, (int)NewLineBeforeOpenBracePlacement.LambdaExpressionBody, CSharpVSResources.Place_open_brace_on_new_line_for_lambda_expression, newLineBeforeOpenBraceValue, s_newLinesForBracesConversions, options, updaterService); 88yield return Setting.Create(CSharpFormattingOptions2.NewLineForElse, CSharpVSResources.Place_else_on_new_line, options, updaterService); 89yield return Setting.Create(CSharpFormattingOptions2.NewLineForCatch, CSharpVSResources.Place_catch_on_new_line, options, updaterService); 90yield return Setting.Create(CSharpFormattingOptions2.NewLineForFinally, CSharpVSResources.Place_finally_on_new_line, options, updaterService); 91yield return Setting.Create(CSharpFormattingOptions2.NewLineForMembersInObjectInit, CSharpVSResources.Place_members_in_object_initializers_on_new_line, options, updaterService); 92yield return Setting.Create(CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes, CSharpVSResources.Place_members_in_anonymous_types_on_new_line, options, updaterService); 93yield return Setting.Create(CSharpFormattingOptions2.NewLineForClausesInQuery, CSharpVSResources.Place_query_expression_clauses_on_new_line, options, updaterService); 98yield return Setting.Create(CSharpFormattingOptions2.IndentBlock, CSharpVSResources.Indent_block_contents, options, updaterService); 99yield return Setting.Create(CSharpFormattingOptions2.IndentBraces, CSharpVSResources.Indent_open_and_close_braces, options, updaterService); 100yield return Setting.Create(CSharpFormattingOptions2.IndentSwitchCaseSection, CSharpVSResources.Indent_case_contents, options, updaterService); 101yield return Setting.Create(CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock, CSharpVSResources.Indent_case_contents_when_block, options, updaterService); 102yield return Setting.Create(CSharpFormattingOptions2.IndentSwitchSection, CSharpVSResources.Indent_case_labels, options, updaterService); 103yield return Setting.Create(CSharpFormattingOptions2.LabelPositioning, CSharpVSResources.Label_Indentation, options, updaterService); 108yield return Setting.Create(CSharpFormattingOptions2.WrappingPreserveSingleLine, CSharpVSResources.Leave_block_on_single_line, options, updaterService); 109yield return Setting.Create(CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, CSharpVSResources.Leave_statements_and_member_declarations_on_the_same_line, options, updaterService);
Options\AutomationObject\AutomationObject.Formatting.cs (98)
14get { return GetBooleanOption(CSharpFormattingOptions2.IndentBlock); } 15set { SetBooleanOption(CSharpFormattingOptions2.IndentBlock, value); } 20get { return GetBooleanOption(CSharpFormattingOptions2.IndentBraces); } 21set { SetBooleanOption(CSharpFormattingOptions2.IndentBraces, value); } 26get { return GetBooleanOption(CSharpFormattingOptions2.IndentSwitchCaseSection); } 27set { SetBooleanOption(CSharpFormattingOptions2.IndentSwitchCaseSection, value); } 32get { return GetBooleanOption(CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock); } 33set { SetBooleanOption(CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock, value); } 38get { return GetBooleanOption(CSharpFormattingOptions2.IndentSwitchSection); } 39set { SetBooleanOption(CSharpFormattingOptions2.IndentSwitchSection, value); } 44get { return (int)GetOption(CSharpFormattingOptions2.LabelPositioning); } 45set { SetOption(CSharpFormattingOptions2.LabelPositioning, (LabelPositionOptionsInternal)value); } 50get { return (int)GetOption(CSharpFormattingOptions2.LabelPositioning); } 51set { SetOption(CSharpFormattingOptions2.LabelPositioning, (LabelPositionOptionsInternal)value); } 56get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes); } 57set { SetBooleanOption(CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes, value); } 62get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousMethods); } 63set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousMethods, value); } 68get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousTypes); } 69set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.AnonymousTypes, value); } 74get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ControlBlocks); } 75set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ControlBlocks, value); } 80get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.LambdaExpressionBody); } 81set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.LambdaExpressionBody, value); } 86get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Methods); } 87set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Methods, value); } 92get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Properties); } 93set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Properties, value); } 98get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Accessors); } 99set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Accessors, value); } 104get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers); } 105set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers, value); } 110get { return GetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Types); } 111set { SetBooleanOption(CSharpFormattingOptions2.NewLineBeforeOpenBrace, NewLineBeforeOpenBracePlacement.Types, value); } 116get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForCatch); } 117set { SetBooleanOption(CSharpFormattingOptions2.NewLineForCatch, value); } 122get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForElse); } 123set { SetBooleanOption(CSharpFormattingOptions2.NewLineForElse, value); } 128get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForFinally); } 129set { SetBooleanOption(CSharpFormattingOptions2.NewLineForFinally, value); } 134get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForMembersInObjectInit); } 135set { SetBooleanOption(CSharpFormattingOptions2.NewLineForMembersInObjectInit, value); } 140get { return GetBooleanOption(CSharpFormattingOptions2.NewLineForClausesInQuery); } 141set { SetBooleanOption(CSharpFormattingOptions2.NewLineForClausesInQuery, value); } 146get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration); } 147set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration, value); } 152get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterCast); } 153set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterCast, value); } 158get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterComma); } 159set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterComma, value); } 164get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterDot); } 165set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterDot, value); } 170get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterMethodCallName); } 171set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterMethodCallName, value); } 176get { return GetBooleanOption(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName); } 177set { SetBooleanOption(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName, value); } 182get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement); } 183set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement, value); } 188get { return (int)GetOption(CSharpFormattingOptions2.SpacingAroundBinaryOperator); } 189set { SetOption(CSharpFormattingOptions2.SpacingAroundBinaryOperator, (BinaryOperatorSpacingOptionsInternal)value); } 194get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration); } 195set { SetBooleanOption(CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration, value); } 200get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBeforeComma); } 201set { SetBooleanOption(CSharpFormattingOptions2.SpaceBeforeComma, value); } 206get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBeforeDot); } 207set { SetBooleanOption(CSharpFormattingOptions2.SpaceBeforeDot, value); } 212get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket); } 213set { SetBooleanOption(CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket, value); } 218get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement); } 219set { SetBooleanOption(CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement, value); } 224get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses); } 225set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, value); } 230get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses); } 231set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses, value); } 236get { return GetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets); } 237set { SetBooleanOption(CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets, value); } 242get { return GetBooleanOption(CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword); } 243set { SetBooleanOption(CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword, value); } 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); } 266get { return GetBooleanOption(CSharpFormattingOptions2.SpaceWithinMethodCallParentheses); } 267set { SetBooleanOption(CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, value); } 272get { return GetBooleanOption(CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis); } 273set { SetBooleanOption(CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis, value); } 278get { return GetBooleanOption(CSharpFormattingOptions2.SpaceWithinSquareBrackets); } 279set { SetBooleanOption(CSharpFormattingOptions2.SpaceWithinSquareBrackets, value); } 284get { return (int)GetOption(CSharpFormattingOptions2.SpacingAroundBinaryOperator); } 285set { SetOption(CSharpFormattingOptions2.SpacingAroundBinaryOperator, (BinaryOperatorSpacingOptionsInternal)value); } 290get { return GetBooleanOption(CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration); } 291set { SetBooleanOption(CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, value); } 296get { return GetBooleanOption(CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine); } 297set { SetBooleanOption(CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, value); } 302get { return GetBooleanOption(CSharpFormattingOptions2.WrappingPreserveSingleLine); } 303set { SetBooleanOption(CSharpFormattingOptions2.WrappingPreserveSingleLine, value); }
Options\CSharpVisualStudioOptionStorageReadFallbacks.cs (2)
34=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue, readValue, out var intValue) ? (SpacePlacementWithinParentheses)intValue : default(Optional<object?>); 60=> TryReadFlags(s_storages, (int)CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue, readValue, out var intValue) ? (NewLineBeforeOpenBracePlacement)intValue : default(Optional<object?>);
Options\Formatting\IndentationViewModel.cs (8)
86Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.IndentBlock, CSharpVSResources.Indent_block_contents, BlockContentPreview, this, optionStore)); 87Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.IndentBraces, CSharpVSResources.Indent_open_and_close_braces, IndentBracePreview, this, optionStore)); 88Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.IndentSwitchCaseSection, CSharpVSResources.Indent_case_contents, SwitchCasePreview, this, optionStore)); 89Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.IndentSwitchCaseSectionWhenBlock, CSharpVSResources.Indent_case_contents_when_block, SwitchCaseWhenBlockPreview, this, optionStore)); 90Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.IndentSwitchSection, CSharpVSResources.Indent_case_labels, SwitchCasePreview, this, optionStore)); 94Items.Add(new RadioButtonViewModel<LabelPositionOptionsInternal>(CSharpVSResources.Place_goto_labels_in_leftmost_column, GotoLabelPreview, "goto", LabelPositionOptionsInternal.LeftMost, CSharpFormattingOptions2.LabelPositioning, this, optionStore)); 95Items.Add(new RadioButtonViewModel<LabelPositionOptionsInternal>(CSharpVSResources.Indent_labels_normally, GotoLabelPreview, "goto", LabelPositionOptionsInternal.NoIndent, CSharpFormattingOptions2.LabelPositioning, this, optionStore)); 96Items.Add(new RadioButtonViewModel<LabelPositionOptionsInternal>(CSharpVSResources.Place_goto_labels_one_indent_less_than_current, GotoLabelPreview, "goto", LabelPositionOptionsInternal.OneLess, CSharpFormattingOptions2.LabelPositioning, this, optionStore));
Options\Formatting\NewLinesViewModel.cs (15)
236Items.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)); 237Items.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)); 238Items.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)); 239Items.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)); 240Items.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)); 241Items.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)); 242Items.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)); 243Items.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)); 244Items.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)); 248Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForElse, CSharpVSResources.Place_else_on_new_line, s_ifElsePreview, this, optionStore)); 249Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForCatch, CSharpVSResources.Place_catch_on_new_line, s_tryCatchFinallyPreview, this, optionStore)); 250Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForFinally, CSharpVSResources.Place_finally_on_new_line, s_tryCatchFinallyPreview, this, optionStore)); 254Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForMembersInObjectInit, CSharpVSResources.Place_members_in_object_initializers_on_new_line, s_objectInitializerPreview, this, optionStore)); 255Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForMembersInAnonymousTypes, CSharpVSResources.Place_members_in_anonymous_types_on_new_line, s_anonymousTypePreview, this, optionStore)); 256Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.NewLineForClausesInQuery, CSharpVSResources.Place_query_expression_clauses_on_new_line, s_queryExpressionPreview, this, optionStore));
Options\Formatting\SpacingViewModel.cs (26)
128Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName, CSharpVSResources.Insert_space_between_method_name_and_its_opening_parenthesis, s_methodPreview, this, optionStore)); 129Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceWithinMethodDeclarationParenthesis, CSharpVSResources.Insert_space_within_parameter_list_parentheses, s_methodPreview, this, optionStore)); 130Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBetweenEmptyMethodDeclarationParentheses, CSharpVSResources.Insert_space_within_empty_parameter_list_parentheses, s_methodPreview, this, optionStore)); 134Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterMethodCallName, CSharpVSResources.Insert_space_between_called_method_name_and_its_opening_parenthesis, s_methodPreview, this, optionStore)); 135Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceWithinMethodCallParentheses, CSharpVSResources.Insert_space_within_argument_list_parentheses, s_methodPreview, this, optionStore)); 136Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBetweenEmptyMethodCallParentheses, CSharpVSResources.Insert_space_within_empty_argument_list_parentheses, s_methodPreview, this, optionStore)); 140Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterControlFlowStatementKeyword, CSharpVSResources.Insert_space_after_keywords_in_control_flow_statements, s_forDelimiterPreview, this, optionStore)); 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)); 147Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterCast, CSharpVSResources.Insert_space_after_cast, s_castPreview, this, optionStore)); 148Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpacesIgnoreAroundVariableDeclaration, CSharpVSResources.Ignore_spaces_in_declaration_statements, s_declarationSpacingPreview, this, optionStore)); 152Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBeforeOpenSquareBracket, CSharpVSResources.Insert_space_before_open_square_bracket, s_bracketPreview, this, optionStore)); 153Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBetweenEmptySquareBrackets, CSharpVSResources.Insert_space_within_empty_square_brackets, s_bracketPreview, this, optionStore)); 154Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceWithinSquareBrackets, CSharpVSResources.Insert_spaces_within_square_brackets, s_bracketPreview, this, optionStore)); 158Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterColonInBaseTypeDeclaration, CSharpVSResources.Insert_space_after_colon_for_base_or_interface_in_type_declaration, s_baseColonPreview, this, optionStore)); 159Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterComma, CSharpVSResources.Insert_space_after_comma, s_delimiterPreview, this, optionStore)); 160Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterDot, CSharpVSResources.Insert_space_after_dot, s_delimiterPreview, this, optionStore)); 161Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceAfterSemicolonsInForStatement, CSharpVSResources.Insert_space_after_semicolon_in_for_statement, s_forDelimiterPreview, this, optionStore)); 162Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBeforeColonInBaseTypeDeclaration, CSharpVSResources.Insert_space_before_colon_for_base_or_interface_in_type_declaration, s_baseColonPreview, this, optionStore)); 163Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBeforeComma, CSharpVSResources.Insert_space_before_comma, s_delimiterPreview, this, optionStore)); 164Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBeforeDot, CSharpVSResources.Insert_space_before_dot, s_delimiterPreview, this, optionStore)); 165Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.SpaceBeforeSemicolonsInForStatement, CSharpVSResources.Insert_space_before_semicolon_in_for_statement, s_forDelimiterPreview, this, optionStore)); 169Items.Add(new RadioButtonViewModel<BinaryOperatorSpacingOptionsInternal>(CSharpVSResources.Ignore_spaces_around_binary_operators, s_expressionSpacingPreview, "binary", BinaryOperatorSpacingOptionsInternal.Ignore, CSharpFormattingOptions2.SpacingAroundBinaryOperator, this, OptionStore)); 170Items.Add(new RadioButtonViewModel<BinaryOperatorSpacingOptionsInternal>(CSharpVSResources.Remove_spaces_before_and_after_binary_operators, s_expressionSpacingPreview, "binary", BinaryOperatorSpacingOptionsInternal.Remove, CSharpFormattingOptions2.SpacingAroundBinaryOperator, this, OptionStore)); 171Items.Add(new RadioButtonViewModel<BinaryOperatorSpacingOptionsInternal>(CSharpVSResources.Insert_space_before_and_after_binary_operators, s_expressionSpacingPreview, "binary", BinaryOperatorSpacingOptionsInternal.Single, CSharpFormattingOptions2.SpacingAroundBinaryOperator, this, OptionStore));
Options\Formatting\WrappingViewModel.cs (2)
41Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.WrappingPreserveSingleLine, CSharpVSResources.Leave_block_on_single_line, s_blockPreview, this, optionStore)); 42Items.Add(new CheckBoxOptionViewModel(CSharpFormattingOptions2.WrappingKeepStatementsOnSingleLine, CSharpVSResources.Leave_statements_and_member_declarations_on_the_same_line, s_declarationPreview, this, optionStore));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (5)
EditorConfigSettings\DataProvider\DataProviderTests.cs (1)
209AssertEx.SetEqual(CSharpFormattingOptions2.EditorConfigOptions, optionsForSettings);
Options\OptionViewModelTests.cs (4)
77workspace.GlobalOptions.SetGlobalOption(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName, true); 82var checkbox = viewModel.Items.OfType<CheckBoxOptionViewModel>().Where(c => c.Option == CSharpFormattingOptions2.SpacingAfterMethodDeclarationName).First(); 94var checkbox = viewModel.Items.OfType<CheckBoxOptionViewModel>().Where(c => c.Option == CSharpFormattingOptions2.SpacingAfterMethodDeclarationName).First(); 98Assert.NotEqual(optionStore.GetOption(CSharpFormattingOptions2.SpacingAfterMethodDeclarationName), initial);
Roslyn.VisualStudio.Next.UnitTests (7)
Options\VisualStudioSettingsOptionPersisterTests.cs (3)
115var optionKey = new OptionKey2(CSharpFormattingOptions2.NewLineBeforeOpenBrace); 126Assert.Equal(value, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.AnonymousTypes); 139Assert.Equal((optionKey, CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.Methods), refreshedOptions.Single());
Options\VisualStudioStorageReadFallbackTests.cs (4)
34CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue & ~SpacePlacementWithinParentheses.Expressions); 39CSharpFormattingOptions2.SpaceBetweenParentheses.DefaultValue | SpacePlacementWithinParentheses.Expressions); 58CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue & ~NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers); 63CSharpFormattingOptions2.NewLineBeforeOpenBrace.DefaultValue | NewLineBeforeOpenBracePlacement.ObjectCollectionArrayInitializers);