10 instantiations of NotificationOption2
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (3)
ExtractMethod\ExtractMethodCodeRefactoringTests.cs (1)
5239{ CodeStyleOptions2.QualifyMethodAccess, new CodeStyleOption2<bool>(true, new(diagnostic, true)) },
src\Analyzers\CSharp\Tests\InlineDeclaration\CSharpInlineDeclarationTests.cs (2)
2465{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, new CodeStyleOption2<bool>(preferIntrinsicPredefinedTypeKeywordInDeclaration, new NotificationOption2(preferIntrinsicPredefinedTypeKeywordInDeclarationDiagnostic, false)) }, 2466{ CSharpCodeStyleOptions.VarForBuiltInTypes, new CodeStyleOption2<bool>(varForBuiltInTypes, new NotificationOption2(varForBuiltInTypesDiagnostic, false)) },
Microsoft.CodeAnalysis.Workspaces (7)
CodeStyle\CodeStyleOption.cs (1)
34: this(new CodeStyleOption2<T>(value, new NotificationOption2(notification.Severity, IsExplicitlySpecified: false)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (6)
21public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false); 26public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false); 31public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false); 36public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false); 41public static NotificationOption2 Error => new(ReportDiagnostic.Error, false); 44=> new(Severity, isExplicitlySpecified);
577 references to NotificationOption2
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
ConvertNamespace\ConvertNamespaceCommandHandler.cs (1)
51new(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Suggestion);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (49)
CodeActions\GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersTests.cs (6)
56{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Suggestion }, 57{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, true, NotificationOption2.Suggestion }, 58{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Suggestion }, 64{ CSharpCodeStyleOptions.VarElsewhere, false, NotificationOption2.Suggestion }, 65{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, false, NotificationOption2.Suggestion }, 66{ CSharpCodeStyleOptions.VarForBuiltInTypes, false, NotificationOption2.Suggestion },
CodeActions\GenerateType\GenerateTypeTests.cs (6)
2949options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error)); 3247options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)); 3330options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)); 3362options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error)); 3680parameters: new TestParameters(options: Option(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, AddImportPlacement.InsideNamespace, NotificationOption2.Error))); 5236options: Option(CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent)));
CodeActions\InitializeParameter\AddParameterCheckTests.cs (2)
1004{ CSharpCodeStyleOptions.PreferThrowExpression, false, NotificationOption2.Silent } 2075{ CSharpCodeStyleOptions.PreferBraces, new CodeStyleOption2<PreferBracesPreference>((PreferBracesPreference)preferBraces, NotificationOption2.Silent) },
CodeActions\InitializeParameter\InitializeMemberFromParameterTests.cs (3)
1457private TestParameters OmitIfDefault_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.OmitIfDefault, NotificationOption2.Warning)); 1458private TestParameters Never_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Never, NotificationOption2.Warning)); 1459private TestParameters Always_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Always, NotificationOption2.Warning));
CodeActions\InitializeParameter\InitializeMemberFromPrimaryConstructorParameterTests.cs (3)
26private TestParameters OmitIfDefault_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.OmitIfDefault, NotificationOption2.Warning)); 27private TestParameters Never_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Never, NotificationOption2.Warning)); 28private TestParameters Always_Warning => new TestParameters(options: Option(CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Always, NotificationOption2.Warning));
CodeActions\PullMemberUp\CSharpPullMemberUpTests.cs (1)
3615options: Option(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, AddImportPlacement.InsideNamespace, CodeStyle.NotificationOption2.Silent));
Completion\CompletionProviders\PartialMethodCompletionProviderTests.cs (2)
714{ CSharpCodeStyleOptions.PreferExpressionBodiedMethods, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent) } 741{ CSharpCodeStyleOptions.PreferExpressionBodiedMethods, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent) }
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (1)
98var option = new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.InsideNamespace, NotificationOption2.Warning);
EventHookup\EventHookupCommandHandlerTests.cs (3)
926using var testState = EventHookupTestState.CreateTestState(markup, QualifyMethodAccessWithNotification(NotificationOption2.Error)); 1013using var testState = EventHookupTestState.CreateTestState(markup, QualifyMethodAccessWithNotification(NotificationOption2.Silent)); 1205private static OptionsCollection QualifyMethodAccessWithNotification(NotificationOption2 notification)
ExtractInterface\ExtractInterfaceTests.cs (4)
395{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent } 435{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent } 476{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent } 903{ CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Always, NotificationOption2.Silent }
Formatting\CodeCleanupTests.cs (5)
810=> AssertCodeCleanupResult(expected, code, new(AddImportPlacement.OutsideNamespace, NotificationOption2.Silent), systemUsingsFirst, separateUsingGroups, enabledFixIdsFilter, diagnosticIdsWithSeverity); 875new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.InsideNamespace, NotificationOption2.Error); 878new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.OutsideNamespace, NotificationOption2.Error); 881new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.InsideNamespace, NotificationOption2.None); 884new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.OutsideNamespace, NotificationOption2.None);
Formatting\CSharpNewDocumentFormattingServiceTests.cs (12)
55{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Error) } 77{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Error) } 99{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Error) } 124{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Error) } 140{ CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.OutsideNamespace, NotificationOption2.Error) } 191{ CodeStyleOptions2.AccessibilityModifiersRequired, new CodeStyleOption2<AccessibilityModifiersRequired>(AccessibilityModifiersRequired.Always, NotificationOption2.Error) } 216{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Error) }, 217{ CodeStyleOptions2.AccessibilityModifiersRequired, new CodeStyleOption2<AccessibilityModifiersRequired>(AccessibilityModifiersRequired.Always, NotificationOption2.Error) } 261{ CodeStyleOptions2.AccessibilityModifiersRequired, new CodeStyleOption2<AccessibilityModifiersRequired>(AccessibilityModifiersRequired.Always, NotificationOption2.Error) } 281{ CSharpCodeStyleOptions.PreferredUsingDirectivePlacement, new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.InsideNamespace, NotificationOption2.Error) } 300{ CSharpCodeStyleOptions.PreferTopLevelStatements, new CodeStyleOption2<bool>(value: true, notification: NotificationOption2.Suggestion) } 324{ CSharpCodeStyleOptions.PreferTopLevelStatements, new CodeStyleOption2<bool>(value: false, notification: NotificationOption2.Suggestion) }
GenerateConstructors\GenerateConstructorsTests.cs (1)
520""", options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error));
Microsoft.CodeAnalysis.CSharp.Features (39)
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (5)
116NotificationOption2 notificationOption) 170NotificationOption2 notificationOption, 187NotificationOption2.ForSeverity(Descriptor.DefaultSeverity), 208NotificationOption2.ForSeverity(Descriptor.DefaultSeverity), 222NotificationOption2 notificationOption)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
133NotificationOption2 notificationOption,
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (2)
44private void Recurse(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxNode node) 62SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, ArrowExpressionClauseSyntax arrowExpressionClause)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (2)
44private void Recurse(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, ArrayBuilder<SyntaxNode> stack) 77private void ProcessToken(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SourceText text, SyntaxToken token)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (2)
44private void Recurse(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxNode node) 66SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, ConstructorInitializerSyntax initializer)
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (2)
41private void Recurse(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxNode node) 68private bool CheckStatementSyntax(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, StatementSyntax statement)
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
31NotificationOption2 notificationOption,
src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
44NotificationOption2.Warning,
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (2)
125NotificationOption2.ForSeverity(Descriptor.DefaultSeverity), 144NotificationOption2.ForSeverity(Descriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (2)
205SyntaxNodeAnalysisContext context, SyntaxTree syntaxTree, NotificationOption2 notification, ExpressionSyntax expression, bool changesSemantics) 227NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (2)
74NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), 92NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
68NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
110NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
77NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), 117NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity),
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (2)
60SyntaxNodeAnalysisContext context, VariableDeclarationSyntax variableDeclaration, NotificationOption2 notificationOption) 75SyntaxNodeAnalysisContext context, ForEachStatementSyntax forEachStatement, NotificationOption2 notificationOption)
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
58private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
310private Diagnostic CreateDiagnostic(Result result, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (4)
44private bool ShouldAnalyze(OperationAnalysisContext context, out NotificationOption2 notificationOption) 49notificationOption = NotificationOption2.Silent; 59if (!ShouldAnalyze(context, out var notificationOption) || 92if (!ShouldAnalyze(context, out var notificationOption) || syntax is not BinaryExpressionSyntax)
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
103NotificationOption2.Suggestion,
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (3)
117private void ReportParameterArrayDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, ImmutableArray<IOperation> elements, NotificationOption2 notificationOption, ArrayCreationOperationLocation operationLocation) 129private void ReportArrayCreationDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, NotificationOption2 notificationOption) 137private void ReportDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, NotificationOption2 notificationOption, Location location, ArrayCreationOperationLocation operationLocation)
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
385var preferPreservation = styleOption.Notification == NotificationOption2.None;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (279)
ConvertForEachToFor\ConvertForEachToForTests.cs (1)
27private readonly CodeStyleOption2<bool> onWithSilent = new CodeStyleOption2<bool>(true, NotificationOption2.Silent);
ConvertForToForEach\ConvertForToForEachTests.cs (1)
25private readonly CodeStyleOption2<bool> onWithSilent = new CodeStyleOption2<bool>(true, NotificationOption2.Silent);
ConvertNamespace\ConvertNamespaceRefactoringFixAllTests.cs (2)
23=> this.Option(CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Warning); 26=> this.Option(CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Warning);
ConvertProgram\ConvertToProgramMainAnalyzerTests.cs (23)
71Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Silent } }, 97Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Silent } }, 125Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Silent } }, 136Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Silent } }, 148Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.None } }, 169Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 193{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 219Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 248Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 285Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 311Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 341Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 368Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 397Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 423Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 450Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 473Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 495Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 528Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 565Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 597Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 634Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } }, 669Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion } },
ConvertProgram\ConvertToProgramMainRefactoringTests.cs (4)
107{ CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion }, 122{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 137{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Silent }, 161{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.None },
ConvertProgram\ConvertToTopLevelStatementsAnalyzerTests.cs (47)
280Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 300Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 325Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 350Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 372Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 390Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 410Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 430Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 454Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 474Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 495Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 516Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 543Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 566Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 589Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 612Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 635Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 657Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 679Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 703Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 727Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 749Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 771Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 793Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 813Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 842Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 871Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 900Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 929Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 958Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 987Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1016Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1045Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1076Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1102Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1133Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1172Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1211Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1254Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1283Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1326Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1367Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1411Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1453Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1485Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1516Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } }, 1563Options = { { CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion } },
ConvertProgram\ConvertToTopLevelStatementsRefactoringTests.cs (11)
77{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 97{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 118{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 144{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 165{ CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Suggestion }, 186{ CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.Silent }, 211{ CSharpCodeStyleOptions.PreferTopLevelStatements, true, NotificationOption2.None }, 248{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 292{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 332{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion }, 382{ CSharpCodeStyleOptions.PreferTopLevelStatements, false, NotificationOption2.Suggestion },
ConvertTupleToStruct\ConvertTupleToStructTests.cs (3)
35{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Suggestion }, 36{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, true, NotificationOption2.Suggestion }, 37{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Suggestion },
Diagnostics\Configuration\ConfigureSeverity\VarForBuiltInTypesSeverityConfigurationTests.cs (1)
37Assert.Equal(NotificationOption2.Silent, CSharpCodeStyleOptions.VarForBuiltInTypes.DefaultValue.Notification);
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (1)
1559""", new TestParameters(options: Option(CodeStyleOptions2.PreferAutoProperties, true, NotificationOption2.Warning)));
EncapsulateField\EncapsulateFieldTests.cs (4)
200{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent }, 201{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.Silent } 1254""", options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error)); 1283""", options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error));
ExtractClass\ExtractClassTests.cs (4)
606{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent } 661{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent } 716{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent } 1217{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Error },
ExtractMethod\ExtractMethodCodeRefactoringTests.cs (3)
52private static readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 53private static readonly CodeStyleOption2<bool> offWithInfo = new(false, NotificationOption2.Suggestion); 83{ CSharpCodeStyleOptions.PreferBraces, new CodeStyleOption2<PreferBracesPreference>(PreferBracesPreference.None, NotificationOption2.Suggestion) }
GenerateVariable\GenerateVariableTests.cs (1)
37private readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion);
IntroduceUsingStatement\IntroduceUsingStatementTests.cs (2)
25{ CSharpCodeStyleOptions.PreferSimpleUsingStatement, new CodeStyleOption2<bool>(false, NotificationOption2.Silent) } 30{ CSharpCodeStyleOptions.PreferSimpleUsingStatement, new CodeStyleOption2<bool>(true, NotificationOption2.Silent) }
IntroduceVariable\IntroduceLocalForExpressionTests.cs (2)
21private static readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 22private static readonly CodeStyleOption2<bool> offWithInfo = new(false, NotificationOption2.Suggestion);
IntroduceVariable\IntroduceVariableTests.cs (4)
31private readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion); 3888{ CSharpCodeStyleOptions.ImplicitObjectCreationWhenTypeIsApparent, new CodeStyleOption2<bool>(true, NotificationOption2.Warning) }, 3922{ CSharpCodeStyleOptions.ImplicitObjectCreationWhenTypeIsApparent, new CodeStyleOption2<bool>(true, NotificationOption2.Warning) }, 3965{ CSharpCodeStyleOptions.ImplicitObjectCreationWhenTypeIsApparent, new CodeStyleOption2<bool>(true, NotificationOption2.Warning) },
PreferFrameworkType\PreferFrameworkTypeTests.cs (6)
27private readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 28private readonly CodeStyleOption2<bool> offWithInfo = new(false, NotificationOption2.Suggestion); 33{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion }, 40{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion }, 47{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion }, 54{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion },
SimplifyThisOrMe\SimplifyThisOrMeTests.cs (3)
100options: Option(CodeStyleOptions2.QualifyPropertyAccess, false, NotificationOption2.Warning), 360{ CodeStyleOptions2.QualifyPropertyAccess, false, NotificationOption2.Suggestion }, 361{ CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Suggestion },
SimplifyTypeNames\SimplifyTypeNamesTests.cs (15)
4151""", new TestParameters(options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error))); 4279""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, false, NotificationOption2.Error))); 4322""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, false, NotificationOption2.Error))); 4362""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, false, NotificationOption2.Error))); 4413""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error))); 4428""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error))); 4443""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Error))); 4526""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, false, NotificationOption2.Error))); 4539""", new TestParameters(options: Option(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, false, NotificationOption2.Error))); 6841{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Error }, 6848{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Error }, 6855{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, true, NotificationOption2.Error }, 6867private readonly CodeStyleOption2<bool> offWithSilent = new(false, NotificationOption2.Silent); 6868private readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 6869private readonly CodeStyleOption2<bool> onWithError = new(true, NotificationOption2.Error);
src\Analyzers\CSharp\Tests\AddBraces\AddBracesTests.cs (17)
48new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 72new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 92new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 112new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 132new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 152new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 173new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 201new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 236new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 257new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 278new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 298new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 1378new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 1400new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 1424new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, (PreferBracesPreference)bracesPreference, NotificationOption2.Silent))); 1856await TestInRegularAndScriptAsync(initialMarkup, expectedMarkup, options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent)); 1860await TestMissingInRegularAndScriptAsync(initialMarkup, new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent)));
src\Analyzers\CSharp\Tests\ConvertNamespace\ConvertToBlockScopedNamespaceAnalyzerTests.cs (1)
67{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Suggestion }
src\Analyzers\CSharp\Tests\ConvertNamespace\ConvertToFileScopedNamespaceAnalyzerTests.cs (1)
87{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped, NotificationOption2.Suggestion }
src\Analyzers\CSharp\Tests\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionTests.cs (13)
866{ CSharpCodeStyleOptions.PreferSwitchExpression, true, NotificationOption2.Warning }, 1288{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1352{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1416{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1488{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1552{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1616{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1680{ CSharpCodeStyleOptions.VarElsewhere, true, NotificationOption2.Silent }, 1723{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Silent }, 1766{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Silent }, 1809{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Silent }, 1852{ CSharpCodeStyleOptions.VarForBuiltInTypes, false, NotificationOption2.Silent }, 1895{ CSharpCodeStyleOptions.VarForBuiltInTypes, true, NotificationOption2.Silent },
src\Analyzers\CSharp\Tests\GenerateConstructor\GenerateConstructorTests.cs (5)
528options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error)); 663options: Option(CodeStyleOptions2.QualifyFieldAccess, true, NotificationOption2.Error)); 831options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)); 966options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error)); 1055options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Error));
src\Analyzers\CSharp\Tests\ImplementAbstractClass\ImplementAbstractClassTests.cs (10)
1374{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent }, 1375{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.Silent }, 1414{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent }, 1415{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.Silent }, 1474{ CSharpCodeStyleOptions.PreferExpressionBodiedIndexers, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent }, 1475{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.Silent }, 1514{ CSharpCodeStyleOptions.PreferExpressionBodiedIndexers, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent }, 1515{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.Silent }, 1543{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.Never, NotificationOption2.Silent }, 1544{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent },
src\Analyzers\CSharp\Tests\InlineDeclaration\CSharpInlineDeclarationTests.cs (1)
30private readonly CodeStyleOption2<bool> s_offWithInfo = new(false, NotificationOption2.Suggestion);
src\Analyzers\CSharp\Tests\MisplacedUsingDirectives\MisplacedUsingDirectivesTests.cs (5)
30new(AddImportPlacement.OutsideNamespace, NotificationOption2.None); 33new(AddImportPlacement.InsideNamespace, NotificationOption2.None); 36new(AddImportPlacement.InsideNamespace, NotificationOption2.Error); 39new(AddImportPlacement.OutsideNamespace, NotificationOption2.Error); 42new(AddImportPlacement.OutsideNamespaceIgnoringAliases, NotificationOption2.Error);
src\Analyzers\CSharp\Tests\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementTests.cs (1)
77Options = { { CSharpCodeStyleOptions.AllowEmbeddedStatementsOnSameLine, true, NotificationOption2.Suggestion } }
src\Analyzers\CSharp\Tests\QualifyMemberAccess\QualifyMemberAccessTests.cs (8)
31=> TestAsyncWithOptionAndNotificationOption(code, expected, option, NotificationOption2.Error); 33private Task TestAsyncWithOptionAndNotificationOption(string code, string expected, PerLanguageOption2<CodeStyleOption2<bool>> option, NotificationOption2 notification) 37=> TestMissingAsyncWithOptionAndNotificationOption(code, option, NotificationOption2.Error); 39private Task TestMissingAsyncWithOptionAndNotificationOption(string code, PerLanguageOption2<CodeStyleOption2<bool>> option, NotificationOption2 notification) 1411CodeStyleOptions2.QualifyPropertyAccess, NotificationOption2.Silent); 1438CodeStyleOptions2.QualifyPropertyAccess, NotificationOption2.Suggestion); 1465CodeStyleOptions2.QualifyPropertyAccess, NotificationOption2.Warning); 1492CodeStyleOptions2.QualifyPropertyAccess, NotificationOption2.Error);
src\Analyzers\CSharp\Tests\QualifyMemberAccess\QualifyMemberAccessTests_FixAllTests.cs (1)
93options: Option(CodeStyleOptions2.QualifyPropertyAccess, true, NotificationOption2.Suggestion));
src\Analyzers\CSharp\Tests\RemoveUnnecessaryLambdaExpression\RemoveUnnecessaryLambdaExpressionTests.cs (1)
116Options = { { CSharpCodeStyleOptions.PreferMethodGroupConversion, new CodeStyleOption2<bool>(false, NotificationOption2.None) } }
src\Analyzers\CSharp\Tests\RemoveUnusedParametersAndValues\RemoveUnusedParametersTests.cs (4)
43new CodeStyleOption2<UnusedParametersPreference>(UnusedParametersPreference.NonPublicMethods, NotificationOption2.Suggestion)); 151new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.None)); 1383new CodeStyleOption2<UnusedParametersPreference>(default, NotificationOption2.Suggestion)); 1414new CodeStyleOption2<UnusedParametersPreference>((UnusedParametersPreference)2, NotificationOption2.Suggestion));
src\Analyzers\CSharp\Tests\RemoveUnusedParametersAndValues\RemoveUnusedValueAssignmentTests.cs (7)
30new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.None)); 34new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Suggestion)); 38new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Suggestion)); 61{ CSharpCodeStyleOptions.UnusedValueAssignment, UnusedValuePreference.DiscardVariable, NotificationOption2.None }, 83{ CSharpCodeStyleOptions.UnusedValueAssignment, UnusedValuePreference.DiscardVariable, NotificationOption2.None }, 190{ CodeStyleOptions2.UnusedParameters, UnusedParametersPreference.NonPublicMethods, NotificationOption2.None }, 221{ CodeStyleOptions2.UnusedParameters, UnusedParametersPreference.NonPublicMethods, NotificationOption2.Silent },
src\Analyzers\CSharp\Tests\RemoveUnusedParametersAndValues\RemoveUnusedValueExpressionStatementTests.cs (3)
29new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.None)); 33new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Silent)); 37new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Silent));
src\Analyzers\CSharp\Tests\UseExplicitTupleName\UseExplicitTupleNameTests.cs (2)
210{ CodeStyleOptions2.PreferExplicitTupleNames, false, NotificationOption2.Warning } 230{ CodeStyleOptions2.PreferExplicitTupleNames, false, NotificationOption2.Warning }
src\Analyzers\CSharp\Tests\UseExpressionBody\UseExpressionBodyForAccessorsAnalyzerTests.cs (3)
511{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.None }, 512{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.None }, 513{ CSharpCodeStyleOptions.PreferExpressionBodiedIndexers, ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.None },
src\Analyzers\CSharp\Tests\UseExpressionBody\UseExpressionBodyForMethodsAnalyzerTests.cs (8)
48Assert.Equal(NotificationOption2.Silent, option.Notification); 52Assert.Equal(NotificationOption2.Silent, option.Notification); 56Assert.Equal(NotificationOption2.Silent, option.Notification); 60Assert.Equal(NotificationOption2.Silent, option.Notification); 64Assert.Equal(NotificationOption2.Silent, option.Notification); 68Assert.Equal(NotificationOption2.Error.WithIsExplicitlySpecified(true), option.Notification); 72Assert.Equal(NotificationOption2.Warning.WithIsExplicitlySpecified(true), option.Notification); 76Assert.Equal(NotificationOption2.Suggestion.WithIsExplicitlySpecified(true), option.Notification);
src\Analyzers\CSharp\Tests\UseImplicitOrExplicitType\UseExplicitTypeTests.cs (5)
27private readonly CodeStyleOption2<bool> offWithSilent = new(false, NotificationOption2.Silent); 28private readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 29private readonly CodeStyleOption2<bool> offWithInfo = new(false, NotificationOption2.Suggestion); 30private readonly CodeStyleOption2<bool> offWithWarning = new(false, NotificationOption2.Warning); 31private readonly CodeStyleOption2<bool> offWithError = new(false, NotificationOption2.Error);
src\Analyzers\CSharp\Tests\UseImplicitOrExplicitType\UseImplicitTypeTests.cs (5)
28private static readonly CodeStyleOption2<bool> onWithSilent = new(true, NotificationOption2.Silent); 29private static readonly CodeStyleOption2<bool> onWithInfo = new(true, NotificationOption2.Suggestion); 30private static readonly CodeStyleOption2<bool> offWithInfo = new(false, NotificationOption2.Suggestion); 31private static readonly CodeStyleOption2<bool> onWithWarning = new(true, NotificationOption2.Warning); 32private static readonly CodeStyleOption2<bool> onWithError = new(true, NotificationOption2.Error);
src\Analyzers\CSharp\Tests\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs (1)
609var warningOption = new CodeStyleOption2<bool>(true, NotificationOption2.Warning);
src\Analyzers\CSharp\Tests\UseTupleSwap\UseTupleSwapTests.cs (1)
59{ CSharpCodeStyleOptions.PreferTupleSwap, false, CodeStyle.NotificationOption2.Silent }
src\Analyzers\CSharp\Tests\UseUnboundGenericTypeInNameOf\UseUnboundGenericTypeInNameOfTests.cs (1)
105{ CSharpCodeStyleOptions.PreferUnboundGenericTypeInNameOf, false, CodeStyle.NotificationOption2.Silent }
src\Analyzers\CSharp\Tests\UseVarTestExtensions.cs (10)
19private static readonly CodeStyleOption2<bool> onWithNone = new CodeStyleOption2<bool>(true, NotificationOption2.None); 20private static readonly CodeStyleOption2<bool> offWithNone = new CodeStyleOption2<bool>(false, NotificationOption2.None); 21private static readonly CodeStyleOption2<bool> onWithSilent = new CodeStyleOption2<bool>(true, NotificationOption2.Silent); 22private static readonly CodeStyleOption2<bool> offWithSilent = new CodeStyleOption2<bool>(false, NotificationOption2.Silent); 23private static readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion); 24private static readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion); 25private static readonly CodeStyleOption2<bool> onWithWarning = new CodeStyleOption2<bool>(true, NotificationOption2.Warning); 26private static readonly CodeStyleOption2<bool> offWithWarning = new CodeStyleOption2<bool>(false, NotificationOption2.Warning); 27private static readonly CodeStyleOption2<bool> offWithError = new CodeStyleOption2<bool>(false, NotificationOption2.Error); 28private static readonly CodeStyleOption2<bool> onWithError = new CodeStyleOption2<bool>(true, NotificationOption2.Error);
UseExpressionBody\Refactoring\UseExpressionBodyForAccessorsRefactoringTests.cs (8)
36{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 37{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.Never, NotificationOption2.None }, 50{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 51{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 64{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.None }, 65{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 78{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.None }, 79{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.Never, NotificationOption2.None },
UseExpressionBody\Refactoring\UseExpressionBodyForConstructorsRefactoringTests.cs (2)
29=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedConstructors, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 35=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedConstructors, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForConversionOperatorsRefactoringTests.cs (2)
29=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedOperators, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 35=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedOperators, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForIndexersRefactoringTests.cs (2)
30=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedIndexers, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 36=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedIndexers, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForLocalFunctionsRefactoringTests.cs (2)
29=> Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 35=> Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForMethodsRefactoringTests.cs (2)
28=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedMethods, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 34=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedMethods, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForOperatorsRefactoringTests.cs (2)
29=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedOperators, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); 35=> this.Option(CSharpCodeStyleOptions.PreferExpressionBodiedOperators, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None));
UseExpressionBody\Refactoring\UseExpressionBodyForPropertiesRefactoringTests.cs (6)
37{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 38{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.Never, NotificationOption2.None }, 51{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 52{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.WhenPossible, NotificationOption2.None }, 72{ CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, ExpressionBodyPreference.Never, NotificationOption2.None }, 73{ CSharpCodeStyleOptions.PreferExpressionBodiedProperties, ExpressionBodyPreference.Never, NotificationOption2.None },
UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs (1)
31{ CSharpCodeStyleOptions.PreferPatternMatching, new CodeStyleOption2<bool>(false, NotificationOption2.None) }
Microsoft.CodeAnalysis.CSharp.Workspaces (25)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpCodeGenerationOptions.cs (3)
17new(ExpressionBodyPreference.Never, NotificationOption2.Silent); 20new(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent); 23new(NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (8)
96new(ExpressionBodyPreference.Never, NotificationOption2.Silent); 99new(ExpressionBodyPreference.Never, NotificationOption2.Suggestion); 102new(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent); 105new(ExpressionBodyPreference.WhenPossible, NotificationOption2.Suggestion); 108new(ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.Silent); 181defaultValue: new CodeStyleOption2<string>(string.Join(",", s_preferredModifierOrderDefault.Select(SyntaxFacts.GetText)), NotificationOption2.Silent)); 233defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Silent), 239defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Suggestion),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions_Parsing.cs (4)
18@default.Notification, out var value, out var notification)) 52optionString, @default.Notification, out var value, out var notification)) 82optionString, @default.Notification, out var value, out var notification)) 114out var notificationOption))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\CSharpSyntaxFormattingOptions.cs (2)
18new(NamespaceDeclarationPreference.BlockScoped, NotificationOption2.Silent); 21new(value: true, notification: NotificationOption2.Silent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpSimplifierOptions.cs (1)
19new(PreferBracesPreference.Always, NotificationOption2.Silent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (3)
35public readonly NotificationOption2 Notification; 37public TypeStyleResult(CSharpTypeStyleHelper helper, TypeSyntax typeName, SemanticModel semanticModel, CSharpSimplifierOptions options, bool isStylePreferred, NotificationOption2 notificationOption, CancellationToken cancellationToken) : this() 69var notificationOption = state.GetDiagnosticSeverityPreference();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (4)
22private readonly NotificationOption2 _forBuiltInTypes; 23private readonly NotificationOption2 _whenTypeIsApparent; 24private readonly NotificationOption2 _elsewhere; 56public NotificationOption2 GetDiagnosticSeverityPreference()
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\AddImportsTests.cs (1)
82UsingDirectivePlacement = new CodeStyleOption2<AddImportPlacement>(placeImportsInsideNamespaces ? AddImportPlacement.InsideNamespace : AddImportPlacement.OutsideNamespace, NotificationOption2.None),
CodeStyle\CSharpEditorConfigCodeStyleParserTests.cs (2)
57var defaultValue = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.Error); 73var defaultValue = new CodeStyleOption2<AddImportPlacement>(AddImportPlacement.InsideNamespace, NotificationOption2.Error);
Microsoft.CodeAnalysis.EditorFeatures (6)
EditorConfigSettings\Data\CodeStyleSetting.cs (6)
36var notification = severity switch 38ReportDiagnostic.Hidden => NotificationOption2.Silent, 39ReportDiagnostic.Info => NotificationOption2.Suggestion, 40ReportDiagnostic.Warn => NotificationOption2.Warning, 41ReportDiagnostic.Error => NotificationOption2.Error, 42_ => NotificationOption2.None,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
ExtractInterface\AbstractExtractInterfaceTests.cs (1)
98{ CodeStyleOptions2.AccessibilityModifiersRequired, AccessibilityModifiersRequired.Never, NotificationOption2.Silent }
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
62{ CSharpCodeStyleOptions.NamespaceDeclarations, new CodeStyleOption2<NamespaceDeclarationPreference>(NamespaceDeclarationPreference.FileScoped, NotificationOption2.Silent) }
Microsoft.CodeAnalysis.Features (45)
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (1)
97NotificationOption2.Silent,
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
80NotificationOption2.Warning,
EmbeddedLanguages\RegularExpressions\LanguageServices\AbstractRegexDiagnosticAnalyzer.cs (1)
93NotificationOption2.Warning,
SimplifyThisOrMe\AbstractSimplifyThisOrMeDiagnosticAnalyzer.cs (1)
62memberAccessExpression, semanticModel, simplifierOptions, out var thisExpression, out var notification, cancellationToken)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (10)
90protected bool ShouldSkipAnalysis(SemanticModelAnalysisContext context, NotificationOption2? notification) 93protected bool ShouldSkipAnalysis(SyntaxNodeAnalysisContext context, NotificationOption2? notification) 96protected bool ShouldSkipAnalysis(SyntaxTreeAnalysisContext context, CompilationOptions compilationOptions, NotificationOption2? notification) 99protected bool ShouldSkipAnalysis(CodeBlockAnalysisContext context, NotificationOption2? notification) 102protected bool ShouldSkipAnalysis(OperationAnalysisContext context, NotificationOption2? notification) 105protected bool ShouldSkipAnalysis(OperationBlockAnalysisContext context, NotificationOption2? notification) 112NotificationOption2? notification, 120ImmutableArray<NotificationOption2> notifications, 134foreach (var notification in notifications) 150NotificationOption2? notification,
src\Analyzers\Core\Analyzers\AddRequiredParentheses\AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
166NotificationOption2 notificationOption, ImmutableArray<Location> additionalLocations,
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (8)
42NotificationOption2 notificationOption, 90NotificationOption2 notificationOption, 109NotificationOption2 notificationOption, 158NotificationOption2 notificationOption, 179NotificationOption2 notificationOption, 205NotificationOption2 notificationOption, 257NotificationOption2 notificationOption, 286static IEnumerable<string> GetEffectiveCustomTags(DiagnosticDescriptor descriptor, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
167return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), NotificationOption2.ForSeverity(applicableRule.EnforcementLevel), options, additionalLocations: null, builder.ToImmutable(), failureReason);
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (2)
49private void Recurse(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxNode node, CancellationToken cancellationToken) 67private void ProcessBlockLikeStatement(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxNode block)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (2)
46NotificationOption2 notificationOption, 68private void CheckToken(SyntaxTreeAnalysisContext context, NotificationOption2 notificationOption, SyntaxToken token)
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (2)
63NotificationOption2 notificationOption, 69NotificationOption2 notificationOption,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
621NotificationOption2.ForSeverity(rule.DefaultSeverity),
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (8)
224(UnusedValuePreference preference, NotificationOption2 notification) GetPreferenceAndSeverity(CodeStyleOption2<UnusedValuePreference> option) 229return (default(UnusedValuePreference), NotificationOption2.None); 247private readonly NotificationOption2 _unusedParametersSeverity; 251NotificationOption2 unusedValueExpressionStatementSeverity, 253NotificationOption2 unusedValueAssignmentSeverity, 255NotificationOption2 unusedParametersSeverity) 270public NotificationOption2 UnusedValueExpressionStatementNotification { get; } 272public NotificationOption2 UnusedValueAssignmentSeverity { get; }
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
84protected static ImmutableArray<NotificationOption2> GetAllNotifications(SimplifierOptions options) 138NotificationOption2 notificationOption;
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
379var notification = preferAutoProps.Notification;
src\Analyzers\Core\Analyzers\UseAutoProperty\AnalysisResult.cs (1)
36NotificationOption2 Notification,
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (2)
181var notification = shouldUseCollectionExpression ? preferExpressionOption.Notification : preferInitializerOption.Notification; 259NotificationOption2.ForSeverity(s_unnecessaryCodeDescriptor.DefaultSeverity),
Microsoft.CodeAnalysis.Workspaces (91)
CodeStyle\CodeStyleOption.cs (4)
20NotificationOption2 Notification { get; } 22ICodeStyleOption WithNotification(NotificationOption2 notification); 47NotificationOption2 ICodeStyleOption.Notification => UnderlyingOption.Notification; 49ICodeStyleOption ICodeStyleOption.WithNotification(NotificationOption2 notification) => new CodeStyleOption<T>(Value, (NotificationOption)notification);
CodeStyle\NotificationOption.cs (14)
10/// <inheritdoc cref="NotificationOption2"/> 13private readonly NotificationOption2 _notificationOptionImpl; 26/// <inheritdoc cref="NotificationOption2.Severity"/> 42/// <inheritdoc cref="NotificationOption2.None"/> 43public static readonly NotificationOption None = new(NotificationOption2.None); 45/// <inheritdoc cref="NotificationOption2.Silent"/> 46public static readonly NotificationOption Silent = new(NotificationOption2.Silent); 48/// <inheritdoc cref="NotificationOption2.Suggestion"/> 49public static readonly NotificationOption Suggestion = new(NotificationOption2.Suggestion); 51/// <inheritdoc cref="NotificationOption2.Warning"/> 52public static readonly NotificationOption Warning = new(NotificationOption2.Warning); 54/// <inheritdoc cref="NotificationOption2.Error"/> 55public static readonly NotificationOption Error = new(NotificationOption2.Error); 57private NotificationOption(NotificationOption2 notificationOptionImpl)
CodeStyle\NotificationOption2_operators.cs (1)
9public static explicit operator NotificationOption(NotificationOption2 notificationOption)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\AddImport\AddImportPlacementOptions.cs (1)
14new(AddImportPlacement.OutsideNamespace, NotificationOption2.Silent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (16)
20arg, defaultValue.Notification, out var value, out var notification)) 33arg, defaultValue.Notification, out var value, out var notification)) 54=> TryGetCodeStyleValueAndOptionalNotification(arg, defaultNotification: NotificationOption2.None, out value, out _); 59/// in <paramref name="value"/> and <see cref="NotificationOption2.Error"/> will be returned 64string arg, NotificationOption2 defaultNotification, [NotNullWhen(true)] out string? value, [NotNullWhen(true)] out NotificationOption2 notification) 81if (TryParseNotification(arg.AsSpan(firstColonIndex + 1), out var localNotification)) 96private static bool TryParseNotification(ReadOnlySpan<char> value, out NotificationOption2 notification) 101notification = NotificationOption2.None; 106notification = NotificationOption2.Silent; 109case EditorConfigSeverityStrings.Suggestion: notification = NotificationOption2.Suggestion; return true; 110case EditorConfigSeverityStrings.Warning: notification = NotificationOption2.Warning; return true; 111case EditorConfigSeverityStrings.Error: notification = NotificationOption2.Error; return true; 114notification = NotificationOption2.Silent; 156new(default, NotificationOption2.None); 174defaultCodeStyleOption.Notification, out var value, out var notification))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (15)
21NotificationOption2 Notification { get; } 23ICodeStyleOption2 WithNotification(NotificationOption2 notification); 41public static readonly CodeStyleOption2<bool> TrueWithSilentEnforcement = new(value: true, notification: NotificationOption2.Silent); 42public static readonly CodeStyleOption2<bool> FalseWithSilentEnforcement = new(value: false, notification: NotificationOption2.Silent); 43public static readonly CodeStyleOption2<bool> TrueWithSuggestionEnforcement = new(value: true, notification: NotificationOption2.Suggestion); 44public static readonly CodeStyleOption2<bool> FalseWithSuggestionEnforcement = new(value: false, notification: NotificationOption2.Suggestion); 49public static CodeStyleOption2<bool> GetCodeStyle(bool value, NotificationOption2 notification) 75internal sealed partial class CodeStyleOption2<T>(T value, NotificationOption2 notification) : ICodeStyleOption2, IEquatable<CodeStyleOption2<T>?> 77public static readonly CodeStyleOption2<T> Default = new(default!, NotificationOption2.Silent); 91public NotificationOption2 Notification { get; } = notification; 95ICodeStyleOption2 ICodeStyleOption2.WithNotification(NotificationOption2 notification) => new CodeStyleOption2<T>(Value, notification); 192DiagnosticSeverity.Hidden => NotificationOption2.Silent, 193DiagnosticSeverity.Info => NotificationOption2.Suggestion, 194DiagnosticSeverity.Warning => NotificationOption2.Warning, 195DiagnosticSeverity.Error => NotificationOption2.Error,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (11)
97defaultValue: new CodeStyleOption2<CollectionExpressionPreference>(CollectionExpressionPreference.WhenTypesLooselyMatch, NotificationOption2.Suggestion), 180defaultValue: new CodeStyleOption2<UnusedParametersPreference>(UnusedParametersPreference.AllMethods, NotificationOption2.Suggestion), 184if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification)) 209defaultValue: new CodeStyleOption2<AccessibilityModifiersRequired>(SyntaxFormattingOptions.CommonDefaults.AccessibilityModifiersRequired, NotificationOption2.Silent), 213if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notificationOpt)) 259if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification)) 275new(ParenthesesPreference.AlwaysForClarity, NotificationOption2.Silent); 294defaultValue: new(ParenthesesPreference.NeverIfUnnecessary, NotificationOption2.Silent), 307defaultValue: new CodeStyleOption2<ForEachExplicitCastInSourcePreference>(ForEachExplicitCastInSourcePreference.WhenStronglyTyped, NotificationOption2.Suggestion), 311if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification)) 331defaultValue: new CodeStyleOption2<bool>(value: true, notification: NotificationOption2.Suggestion));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CollectionExpressionPreference.cs (1)
41optionString, defaultValue.Notification, out var value, out var notification))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (9)
13/// <completionlist cref="NotificationOption2"/> 21public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false); 26public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false); 31public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false); 36public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false); 41public static NotificationOption2 Error => new(ReportDiagnostic.Error, false); 43public NotificationOption2 WithIsExplicitlySpecified(bool isExplicitlySpecified) 46public static NotificationOption2 ForSeverity(ReportDiagnostic reportDiagnostic) 57public static NotificationOption2 ForSeverity(DiagnosticSeverity severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\VisualBasic\VisualBasicCodeStyleOptions.cs (3)
31"Dim,Const,WithEvents,Widening,Narrowing,Custom,Async,Iterator", NotificationOption2.Silent)); 46defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Silent), 52defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Suggestion),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticSeverityExtensions.cs (6)
11public static NotificationOption2 ToNotificationOption(this DiagnosticSeverity severity, bool isOverridenSeverity) 13var notificationOption = severity switch 15DiagnosticSeverity.Error => NotificationOption2.Error, 16DiagnosticSeverity.Warning => NotificationOption2.Warning, 17DiagnosticSeverity.Info => NotificationOption2.Suggestion, 18DiagnosticSeverity.Hidden => NotificationOption2.Silent,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\NotificationOptionExtensions.cs (1)
11public static string ToEditorConfigString(this NotificationOption2 notificationOption)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ReportDiagnosticExtensions.cs (7)
25public static NotificationOption2 ToNotificationOption(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity) 28var notificationOption = reportDiagnostic.WithDefaultSeverity(defaultSeverity) switch 30ReportDiagnostic.Error => NotificationOption2.Error, 31ReportDiagnostic.Warn => NotificationOption2.Warning, 32ReportDiagnostic.Info => NotificationOption2.Suggestion, 33ReportDiagnostic.Hidden => NotificationOption2.Silent, 34ReportDiagnostic.Suppress => NotificationOption2.None,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractMemberAccessExpressionSimplifier.cs (2)
37out NotificationOption2 notificationOption, 40notificationOption = NotificationOption2.Silent;
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (8)
Options\OptionsTestHelpers.cs (6)
129.WithNotification((codeStyle.Notification == NotificationOption2.Error) ? NotificationOption2.Warning : NotificationOption2.Error), 132.WithNotification((codeStyle.Notification == NotificationOption2.Error) ? NotificationOption2.Warning : NotificationOption2.Error),
OptionsCollection.cs (2)
53public void Add<T>(Option2<CodeStyleOption2<T>> option, T value, NotificationOption2 notification) 62public void Add<T>(PerLanguageOption2<CodeStyleOption2<T>> option, T value, NotificationOption2 notification)
Microsoft.CodeAnalysis.Workspaces.UnitTests (25)
Options\CodeStyleOptionTests.cs (16)
25var style = new CodeStyleOption2<int>(1, NotificationOption2.Error); 32var style = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.Error); 39var style = new CodeStyleOption2<string>("abc", NotificationOption2.Error); 47new CodeStyleOption2<bool>(true, NotificationOption2.Error).WithValue(false), 48new CodeStyleOption2<bool>(false, NotificationOption2.Error)); 55new CodeStyleOption2<int>(1, NotificationOption2.Error).WithValue(2), 56new CodeStyleOption2<int>(2, NotificationOption2.Error)); 63new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.Error).WithValue(ExpressionBodyPreference.WhenPossible), 64new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.Error)); 71new CodeStyleOption2<string>("abc", NotificationOption2.Error).WithValue("xyz"), 72new CodeStyleOption2<string>("xyz", NotificationOption2.Error)); 81var option = new CodeStyleOption2<bool>(false, NotificationOption2.Silent); 87option = new CodeStyleOption2<bool>(true, NotificationOption2.Silent); 100var option = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.Silent); 106option = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent); 114option = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.Silent);
Options\DocumentOptionSetTests.cs (3)
23new CodeStyleOption2<bool>(true, NotificationOption2.Error))); 32var internalCodeStyleOption = new CodeStyleOption2<bool>(true, NotificationOption2.Warning.WithIsExplicitlySpecified(true)); 53new CodeStyleOption2<bool>(true, NotificationOption2.Error)));
Options\OptionKeyTests.cs (1)
172Assert.Equal(new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion.WithIsExplicitlySpecified(true)), result);
Remote\ServiceDescriptorTests.cs (3)
248QualifyFieldAccess = new CodeStyleOption2<bool>(true, NotificationOption2.Error) 254PreferExpressionBodiedIndexers = new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.Error) 270QualifyFieldAccess = new CodeStyleOption2<bool>(true, NotificationOption2.Error)
WorkspaceServiceTests\GlobalOptionServiceTests.cs (2)
272var perLanguageOption2 = new PerLanguageOption2<CodeStyleOption2<bool>>("test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)).WithPublicOption("test", "test"); 288var option2 = new Option2<CodeStyleOption2<bool>>("test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)).WithPublicOption("test", "test");
Roslyn.VisualStudio.Next.UnitTests (4)
Options\VisualStudioSettingsOptionPersisterTests.cs (4)
96optionType == typeof(CodeStyleOption2<bool>) ? (new CodeStyleOption2<bool>(false, NotificationOption2.Warning), new CodeStyleOption2<bool>(false, NotificationOption2.Warning).ToXElement().ToString()) : 264var value1 = new CodeStyleOption2<int>(1, NotificationOption2.Warning); 265yield return new object?[] { value1, value1.ToXElement().ToString(), new CodeStyleOption2<int>(0, NotificationOption2.None), typeof(CodeStyleOption2<int>) };