diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs index e3923519cbf63..f2dbf68ad4aa4 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs @@ -58,7 +58,7 @@ protected override async Task FixAllAsync( #if CODE_STYLE var options = CSharpSimplifierOptions.Default; #else - var options = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + var options = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); #endif // Bulk apply these, except at the expression level. One fix at the expression level may prevent another fix diff --git a/src/Analyzers/Core/Analyzers/AnalyzerOptionsProvider.cs b/src/Analyzers/Core/Analyzers/AnalyzerOptionsProvider.cs index d119e11e3550a..efa914b38a10b 100644 --- a/src/Analyzers/Core/Analyzers/AnalyzerOptionsProvider.cs +++ b/src/Analyzers/Core/Analyzers/AnalyzerOptionsProvider.cs @@ -49,7 +49,7 @@ public AnalyzerOptionsProvider(IOptionsReader options, string language, Analyzer public CodeStyleOption2 PreferPredefinedTypeKeywordInDeclaration => GetOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, FallbackSimplifierOptions.PreferPredefinedTypeKeywordInDeclaration); public SimplifierOptions GetSimplifierOptions(ISimplification simplification) - => simplification.GetSimplifierOptions(_options, _fallbackOptions.CleanupOptions?.SimplifierOptions); + => simplification.GetSimplifierOptions(_options); // SyntaxFormattingOptions diff --git a/src/EditorFeatures/CSharpTest/EventHookup/EventHookupTestState.cs b/src/EditorFeatures/CSharpTest/EventHookup/EventHookupTestState.cs index 0794fb43754d9..34ee3662015da 100644 --- a/src/EditorFeatures/CSharpTest/EventHookup/EventHookupTestState.cs +++ b/src/EditorFeatures/CSharpTest/EventHookup/EventHookupTestState.cs @@ -40,7 +40,11 @@ public EventHookupTestState(XElement workspaceElement, OptionsCollection options _testSessionHookupMutex = new Mutex(false); _commandHandler.TESTSessionHookupMutex = _testSessionHookupMutex; - options?.SetGlobalOptions(Workspace.GlobalOptions); + + if (options != null) + { + Workspace.SetAnalyzerFallbackOptions(options); + } } public static EventHookupTestState CreateTestState(string markup, OptionsCollection options = null) diff --git a/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs b/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs index e5a5ca8815e4b..bb034974a541b 100644 --- a/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs +++ b/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs @@ -97,7 +97,10 @@ internal static async Task> GetIntentsAsync( OptionsCollection? options = null, string? intentData = null) { - options?.SetGlobalOptions(workspace.GlobalOptions); + if (options != null) + { + workspace.SetAnalyzerFallbackOptions(options); + } var intentSource = workspace.ExportProvider.GetExportedValue(); diff --git a/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb b/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb index 744874b427aa6..3bd42bc2532c8 100644 --- a/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb +++ b/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb @@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.NavigationBar Return document End If - Dim simplifierOptions = Await newDocument.GetSimplifierOptionsAsync(globalOptions, cancellationToken).ConfigureAwait(False) + Dim simplifierOptions = Await newDocument.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(False) Dim formattingOptions = Await newDocument.GetSyntaxFormattingOptionsAsync(globalOptions, cancellationToken).ConfigureAwait(False) newDocument = Await Simplifier.ReduceAsync(newDocument, Simplifier.Annotation, simplifierOptions, cancellationToken).ConfigureAwait(False) diff --git a/src/Features/CSharp/Portable/CodeRefactorings/UseExplicitOrImplicitType/AbstractUseTypeCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/CodeRefactorings/UseExplicitOrImplicitType/AbstractUseTypeCodeRefactoringProvider.cs index 28223f71c1158..7632a6bbfa868 100644 --- a/src/Features/CSharp/Portable/CodeRefactorings/UseExplicitOrImplicitType/AbstractUseTypeCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/CodeRefactorings/UseExplicitOrImplicitType/AbstractUseTypeCodeRefactoringProvider.cs @@ -47,7 +47,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte return; } - var simplifierOptions = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(context.Options, cancellationToken).ConfigureAwait(false); + var simplifierOptions = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var typeStyle = AnalyzeTypeName(declaredType, semanticModel, simplifierOptions, cancellationToken); if (typeStyle.IsStylePreferred && typeStyle.Notification.Severity != ReportDiagnostic.Suppress) { diff --git a/src/Features/CSharp/Portable/GenerateConstructorFromMembers/CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/GenerateConstructorFromMembers/CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs index 058e49683e135..d301224badb3d 100644 --- a/src/Features/CSharp/Portable/GenerateConstructorFromMembers/CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/GenerateConstructorFromMembers/CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs @@ -49,7 +49,7 @@ protected override string ToDisplayString(IParameterSymbol parameter, SymbolDisp protected override async ValueTask PrefersThrowExpressionAsync(Document document, SimplifierOptionsProvider fallbackOptions, CancellationToken cancellationToken) { - var options = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + var options = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); return options.PreferThrowExpression.Value; } diff --git a/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs index a94c7015693e5..ad85222af598f 100644 --- a/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs @@ -94,7 +94,7 @@ protected override async Task CreateTupleDeconstructi CancellationToken cancellationToken) { var semanticFacts = document.GetRequiredLanguageService(); - var simplifierOptions = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(optionsProvider, cancellationToken).ConfigureAwait(false); + var simplifierOptions = (CSharpSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var tupleUnderlyingType = tupleType.TupleUnderlyingType ?? tupleType; diff --git a/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs b/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs index 82afe2421891b..e8e0cd659dab4 100644 --- a/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs +++ b/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs @@ -220,7 +220,7 @@ private async Task EncapsulateFieldAsync( new SyntaxAnnotation(), document); - var simplifierOptions = await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var documentWithProperty = await AddPropertyAsync( document, document.Project.Solution, field, generatedProperty, fallbackOptions, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs index d24e9ef3490c3..6bf4ec9fcb46e 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs @@ -76,7 +76,7 @@ protected override async Task> GetRefactoringsForAllP // Great. The list has parameters that need null checks. Offer to add null checks for all. return [CodeAction.Create( FeaturesResources.Add_null_checks_for_all_parameters, - c => UpdateDocumentForRefactoringAsync(document, blockStatementOpt, listOfParametersOrdinals, parameterSpan, fallbackOptions, c), + c => UpdateDocumentForRefactoringAsync(document, blockStatementOpt, listOfParametersOrdinals, parameterSpan, c), nameof(FeaturesResources.Add_null_checks_for_all_parameters))]; } @@ -96,7 +96,7 @@ protected override async Task> GetRefactoringsForSing if (!ParameterValidForNullCheck(document, parameter, semanticModel, blockStatementOpt, cancellationToken)) return []; - var simplifierOptions = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); // Great. There was no null check. Offer to add one. using var result = TemporaryArray.Empty; @@ -128,7 +128,6 @@ private async Task UpdateDocumentForRefactoringAsync( IBlockOperation? blockStatementOpt, List listOfParametersOrdinals, TextSpan parameterSpan, - CleanCodeGenerationOptionsProvider fallbackOptions, CancellationToken cancellationToken) { TSimplifierOptions? lazySimplifierOptions = null; @@ -156,7 +155,7 @@ private async Task UpdateDocumentForRefactoringAsync( if (!CanOfferRefactoring(functionDeclaration, semanticModel, syntaxFacts, cancellationToken, out blockStatementOpt)) continue; - lazySimplifierOptions ??= (TSimplifierOptions)await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + lazySimplifierOptions ??= (TSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); // If parameter is a string, default check would be IsNullOrEmpty. This is because IsNullOrEmpty is more // commonly used in this regard according to telemetry and UX testing. diff --git a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs index 0ae59492bed8c..6f498ef5690a7 100644 --- a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs +++ b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs @@ -54,7 +54,7 @@ internal AbstractIntroduceVariableCodeAction( protected override async Task GetChangedDocumentAsync(CancellationToken cancellationToken) { var changedDocument = await GetChangedDocumentCoreAsync(cancellationToken).ConfigureAwait(false); - var simplifierOptions = await changedDocument.GetSimplifierOptionsAsync(Options.SimplifierOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await changedDocument.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); return await Simplifier.ReduceAsync(changedDocument, simplifierOptions, cancellationToken).ConfigureAwait(false); } diff --git a/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs b/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs index 29bd9287c26a5..1959ce97852be 100644 --- a/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs +++ b/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs @@ -80,7 +80,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var options = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(context.Options, cancellationToken).ConfigureAwait(false); + var options = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var (node, diagnosticId) = GetNodeToSimplify( root, model, span, options, cancellationToken); @@ -104,7 +104,7 @@ protected override async Task FixAllAsync( { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var simplifierOptions = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = (TSimplifierOptions)await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); foreach (var diagnostic in diagnostics) { diff --git a/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractSnippetProvider.cs b/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractSnippetProvider.cs index 97d1fb5a2f799..081bff40383e7 100644 --- a/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractSnippetProvider.cs +++ b/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractSnippetProvider.cs @@ -151,7 +151,7 @@ private async Task CleanupDocumentAsync( if (document.SupportsSyntaxTree) { var addImportPlacementOptions = await document.GetAddImportPlacementOptionsAsync(fallbackOptions: null, cancellationToken).ConfigureAwait(false); - var simplifierOptions = await document.GetSimplifierOptionsAsync(fallbackOptions: null, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var syntaxFormattingOptions = await document.GetSyntaxFormattingOptionsAsync(fallbackOptions: null, cancellationToken).ConfigureAwait(false); document = await ImportAdder.AddImportsFromSymbolAnnotationAsync( diff --git a/src/LanguageServer/Protocol/ExternalAccess/Razor/SimplifyMethodHandler.cs b/src/LanguageServer/Protocol/ExternalAccess/Razor/SimplifyMethodHandler.cs index 28d1050bd652f..db341b92a151f 100644 --- a/src/LanguageServer/Protocol/ExternalAccess/Razor/SimplifyMethodHandler.cs +++ b/src/LanguageServer/Protocol/ExternalAccess/Razor/SimplifyMethodHandler.cs @@ -59,7 +59,7 @@ public SimplifyMethodHandler() // Call to the Simplifier and pass back the edits. var configOptions = await originalDocument.GetAnalyzerConfigOptionsAsync(cancellationToken).ConfigureAwait(false); var simplificationService = originalDocument.Project.Services.GetRequiredService(); - var options = simplificationService.GetSimplifierOptions(configOptions, simplificationService.DefaultOptions); + var options = simplificationService.GetSimplifierOptions(configOptions); var newDocument = await Simplifier.ReduceAsync(annotatedDocument, options, cancellationToken).ConfigureAwait(false); var changes = await newDocument.GetTextChangesAsync(originalDocument, cancellationToken).ConfigureAwait(false); return changes.Select(change => ProtocolConversions.TextChangeToTextEdit(change, originalSourceText)).ToArray(); diff --git a/src/LanguageServer/Protocol/Features/Options/SimplifierOptionsStorage.cs b/src/LanguageServer/Protocol/Features/Options/SimplifierOptionsStorage.cs deleted file mode 100644 index d216c5adb7cc3..0000000000000 --- a/src/LanguageServer/Protocol/Features/Options/SimplifierOptionsStorage.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; - -namespace Microsoft.CodeAnalysis.Simplification; - -internal static class SimplifierOptionsStorage -{ - public static ValueTask GetSimplifierOptionsAsync(this Document document, IGlobalOptionService globalOptions, CancellationToken cancellationToken) - => document.GetSimplifierOptionsAsync(globalOptions.GetSimplifierOptions(document.Project.Services), cancellationToken); - - public static SimplifierOptions GetSimplifierOptions(this IGlobalOptionService options, LanguageServices languageServices) - => options.GetSimplifierOptions(languageServices, fallbackOptions: null); -} diff --git a/src/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs b/src/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs index e3390a4e9c8ad..3704fdb11da52 100644 --- a/src/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs +++ b/src/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs @@ -138,7 +138,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti // Use the formatting options specified by the client to format the snippet. var formattingOptions = await ProtocolConversions.GetFormattingOptionsAsync(request.Options, document, _globalOptions, cancellationToken).ConfigureAwait(false); - var simplifierOptions = await document.GetSimplifierOptionsAsync(_globalOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var formattedLspSnippet = await GetFormattedLspSnippetAsync(parsedSnippet, wordOnLeft.Value, document, sourceText, formattingOptions, simplifierOptions, cancellationToken).ConfigureAwait(false); diff --git a/src/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs b/src/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs index 33dc6b49bf646..31c6ceb43706a 100644 --- a/src/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs @@ -84,7 +84,7 @@ public async Task TestGetSimplifierOptionsOnTypeScriptDocument() await using var testLspServer = await CreateTsTestLspServerAsync(workspaceXml); var document = testLspServer.GetCurrentSolution().Projects.Single().Documents.Single(); - var simplifierOptions = testLspServer.TestWorkspace.GlobalOptions.GetSimplifierOptions(document.Project.Services, fallbackOptions: null); + var simplifierOptions = testLspServer.TestWorkspace.GlobalOptions.GetSimplifierOptions(document.Project.Services); Assert.Same(SimplifierOptions.CommonDefaults, simplifierOptions); } diff --git a/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.cs b/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.cs index 526e0a7091825..36808805bb5a1 100644 --- a/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.cs +++ b/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionGenerateSwitchCases.cs @@ -55,7 +55,7 @@ protected override int FieldChanged(string field, out int requeryFunction) return (VSConstants.S_OK, snippetFunctionService.SwitchDefaultCaseForm, hasCurrentValue); } - var simplifierOptions = await document.GetSimplifierOptionsAsync(snippetExpansionClient.EditorOptionsService.GlobalOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var value = await snippetFunctionService.GetSwitchExpansionAsync(document, caseGenerationSpan.Value, switchExpressionSpan.Value, simplifierOptions, cancellationToken).ConfigureAwait(false); if (value == null) diff --git a/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.cs b/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.cs index 77665d5efd398..441423e364c80 100644 --- a/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.cs +++ b/src/VisualStudio/Core/Def/Snippets/SnippetFunctions/SnippetFunctionSimpleTypeName.cs @@ -42,7 +42,7 @@ public SnippetFunctionSimpleTypeName( if (!TryGetFieldSpan(out var fieldSpan)) return (VSConstants.E_FAIL, value, hasDefaultValue); - var simplifierOptions = await document.GetSimplifierOptionsAsync(snippetExpansionClient.EditorOptionsService.GlobalOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var simplifiedTypeName = await SnippetFunctionService.GetSimplifiedTypeNameAsync(document, fieldSpan.Value, _fullyQualifiedName, simplifierOptions, cancellationToken).ConfigureAwait(false); if (string.IsNullOrEmpty(simplifiedTypeName)) diff --git a/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs b/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs index d86f436a36f3c..5a3744b54f520 100644 --- a/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs +++ b/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs @@ -1088,7 +1088,7 @@ private SyntaxNode InsertNode( { document = _threadingContext.JoinableTaskFactory.Run(async () => { - var simplifierOptions = await document.GetSimplifierOptionsAsync(_editorOptionsService.GlobalOptions, cancellationToken).ConfigureAwait(false); + var simplifierOptions = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); return await Simplifier.ReduceAsync(document, annotation, simplifierOptions, cancellationToken).ConfigureAwait(false); }); } diff --git a/src/VisualStudio/Core/Impl/CodeModel/FileCodeModel.cs b/src/VisualStudio/Core/Impl/CodeModel/FileCodeModel.cs index c6fbbb5fcedcc..62359b046a62e 100644 --- a/src/VisualStudio/Core/Impl/CodeModel/FileCodeModel.cs +++ b/src/VisualStudio/Core/Impl/CodeModel/FileCodeModel.cs @@ -704,7 +704,7 @@ int IVBFileCodeModelEvents.EndEdit() // perform expensive operations at once var newDocument = State.ThreadingContext.JoinableTaskFactory.Run(async () => { - var simplifierOptions = await _batchDocument.GetSimplifierOptionsAsync(GlobalOptions, CancellationToken.None).ConfigureAwait(false); + var simplifierOptions = await _batchDocument.GetSimplifierOptionsAsync(CancellationToken.None).ConfigureAwait(false); return await Simplifier.ReduceAsync(_batchDocument, Simplifier.Annotation, simplifierOptions, CancellationToken.None).ConfigureAwait(false); }); diff --git a/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.cs b/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.cs index 7b46d9a52c515..d83fd71346b56 100644 --- a/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.cs +++ b/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.cs @@ -46,8 +46,8 @@ internal partial class CSharpSimplificationService() public override SimplifierOptions DefaultOptions => CSharpSimplifierOptions.Default; - public override SimplifierOptions GetSimplifierOptions(IOptionsReader options, SimplifierOptions? fallbackOptions) - => new CSharpSimplifierOptions(options, (CSharpSimplifierOptions?)fallbackOptions); + public override SimplifierOptions GetSimplifierOptions(IOptionsReader options) + => new CSharpSimplifierOptions(options, fallbackOptions: null); public override SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func? expandInsideNode, bool expandParameter, CancellationToken cancellationToken) { diff --git a/src/Workspaces/Core/Portable/Options/LegacyGlobalCodeActionOptionsWorkspaceService.cs b/src/Workspaces/Core/Portable/Options/LegacyGlobalCodeActionOptionsWorkspaceService.cs index 3c3fdb47c529c..ff2967895982c 100644 --- a/src/Workspaces/Core/Portable/Options/LegacyGlobalCodeActionOptionsWorkspaceService.cs +++ b/src/Workspaces/Core/Portable/Options/LegacyGlobalCodeActionOptionsWorkspaceService.cs @@ -41,7 +41,7 @@ ValueTask OptionsProvider.GetO => ValueTaskFactory.FromResult(options.GetSyntaxFormattingOptions(languageServices, fallbackOptions: null)); ValueTask OptionsProvider.GetOptionsAsync(LanguageServices languageServices, CancellationToken cancellationToken) - => ValueTaskFactory.FromResult(options.GetSimplifierOptions(languageServices, fallbackOptions: null)); + => ValueTaskFactory.FromResult(options.GetSimplifierOptions(languageServices)); ValueTask OptionsProvider.GetOptionsAsync(LanguageServices languageServices, CancellationToken cancellationToken) => ValueTaskFactory.FromResult(options.GetAddImportPlacementOptions(languageServices, allowInHiddenRegions: null, fallbackOptions: null)); diff --git a/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs b/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs index c7af9c3154d4e..e054e086ca941 100644 --- a/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs +++ b/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs @@ -42,7 +42,7 @@ protected AbstractSimplificationService(ImmutableArray reducers protected abstract void AddImportDeclarations(TCompilationUnitSyntax root, ArrayBuilder importDeclarations); public abstract SimplifierOptions DefaultOptions { get; } - public abstract SimplifierOptions GetSimplifierOptions(IOptionsReader options, SimplifierOptions? fallbackOptions); + public abstract SimplifierOptions GetSimplifierOptions(IOptionsReader options); protected virtual SyntaxNode TransformReducedNode(SyntaxNode reducedNode, SyntaxNode originalNode) => reducedNode; diff --git a/src/Workspaces/Core/Portable/Simplification/Simplifier.cs b/src/Workspaces/Core/Portable/Simplification/Simplifier.cs index c51be4e025b96..6750525992cf4 100644 --- a/src/Workspaces/Core/Portable/Simplification/Simplifier.cs +++ b/src/Workspaces/Core/Portable/Simplification/Simplifier.cs @@ -244,7 +244,7 @@ internal static Task ReduceAsync(Document document, IEnumerable ReduceAsync( Document document, ImmutableArray reducers, CancellationToken cancellationToken) { - var options = await document.GetSimplifierOptionsAsync(fallbackOptions: null, cancellationToken).ConfigureAwait(false); + var options = await document.GetSimplifierOptionsAsync(cancellationToken).ConfigureAwait(false); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); return await document.GetRequiredLanguageService() .ReduceAsync(document, [root.FullSpan], options, @@ -256,7 +256,7 @@ internal static async Task GetOptionsAsync(Document document, { optionSet ??= await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var simplificationService = document.Project.Solution.Services.GetRequiredLanguageService(document.Project.Language); - return simplificationService.GetSimplifierOptions(optionSet, fallbackOptions: null); + return simplificationService.GetSimplifierOptions(optionSet); } #pragma warning restore } diff --git a/src/Workspaces/CoreTestUtilities/OptionsCollection.cs b/src/Workspaces/CoreTestUtilities/OptionsCollection.cs index 94665d087e9a6..2dd25d10a1461 100644 --- a/src/Workspaces/CoreTestUtilities/OptionsCollection.cs +++ b/src/Workspaces/CoreTestUtilities/OptionsCollection.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles; #if !CODE_STYLE using System.Collections.Immutable; @@ -19,6 +20,7 @@ #if !NETCOREAPP using System; using Roslyn.Utilities; +using System.Text; #endif namespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions @@ -64,9 +66,9 @@ public void Add(PerLanguageOption2> option, T value, Noti public void Add(OptionsCollection? options) => AddRange(options); - public void AddRange(OptionsCollection? options) + public void AddRange(IEnumerable>? options) { - if (options is null) + if (options == null) return; foreach (var (key, value) in options) @@ -95,9 +97,27 @@ public StructuredAnalyzerConfigOptions ToAnalyzerConfigOptions() { Assert.All(this, o => Assert.True(o.Key.Option.Definition.IsEditorConfigOption)); - return StructuredAnalyzerConfigOptions.Create( - new DictionaryAnalyzerConfigOptions( - this.Select(static o => new KeyValuePair(o.Key.Option.Definition.ConfigName, o.Key.Option.Definition.Serializer.Serialize(o.Value))).ToImmutableDictionary())); + var builder = ImmutableDictionary.CreateBuilder(AnalyzerConfigOptions.KeyComparer); + + foreach (var (key, value) in this) + { + if (value is NamingStylePreferences namingPreferences) + { + NamingStylePreferencesEditorConfigSerializer.WriteNamingStylePreferencesToEditorConfig( + namingPreferences.SymbolSpecifications, + namingPreferences.NamingStyles, + namingPreferences.NamingRules, + LanguageName, + entryWriter: builder.Add, + triviaWriter: null); + } + else + { + builder.Add(key.Option.Definition.ConfigName, key.Option.Definition.Serializer.Serialize(value)); + } + } + + return StructuredAnalyzerConfigOptions.Create(new DictionaryAnalyzerConfigOptions(builder.ToImmutable())); } #endif diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/CSharpSimplification.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/CSharpSimplification.cs index ed0177bc6faee..5eace49fe5914 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/CSharpSimplification.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/CSharpSimplification.cs @@ -14,6 +14,6 @@ internal sealed class CSharpSimplification : AbstractSimplification public override SimplifierOptions DefaultOptions => CSharpSimplifierOptions.Default; - public override SimplifierOptions GetSimplifierOptions(IOptionsReader options, SimplifierOptions? fallbackOptions) - => new CSharpSimplifierOptions(options, (CSharpSimplifierOptions?)fallbackOptions); + public override SimplifierOptions GetSimplifierOptions(IOptionsReader options) + => new CSharpSimplifierOptions(options, fallbackOptions: null); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeCleanup/CodeCleanupOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeCleanup/CodeCleanupOptions.cs index 03e3542930354..658ddb186f855 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeCleanup/CodeCleanupOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeCleanup/CodeCleanupOptions.cs @@ -88,7 +88,7 @@ public static CodeCleanupOptions GetCodeCleanupOptions(this IOptionsReader optio => new() { FormattingOptions = options.GetSyntaxFormattingOptions(languageServices, fallbackOptions?.FormattingOptions), - SimplifierOptions = options.GetSimplifierOptions(languageServices, fallbackOptions?.SimplifierOptions), + SimplifierOptions = options.GetSimplifierOptions(languageServices), AddImportOptions = options.GetAddImportPlacementOptions(languageServices, allowImportsInHiddenRegions, fallbackOptions?.AddImportOptions), DocumentFormattingOptions = options.GetDocumentFormattingOptions(fallbackOptions?.DocumentFormattingOptions), }; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/Serialization/NamingStylePreferencesEditorConfigSerializer.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/Serialization/NamingStylePreferencesEditorConfigSerializer.cs index 81bf841ca8526..f27600ca2941d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/Serialization/NamingStylePreferencesEditorConfigSerializer.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/Serialization/NamingStylePreferencesEditorConfigSerializer.cs @@ -31,30 +31,47 @@ public static void AppendNamingStylePreferencesToEditorConfig( ImmutableArray namingStyles, ImmutableArray serializableNamingRules, string language, - StringBuilder editorconfig) + StringBuilder builder) { - editorconfig.AppendLine($"#### {CompilerExtensionsResources.Naming_styles} ####"); + WriteNamingStylePreferencesToEditorConfig( + symbolSpecifications, + namingStyles, + serializableNamingRules, + language, + entryWriter: (name, value) => builder.AppendLine($"{name} = {value}"), + triviaWriter: trivia => builder.AppendLine(trivia)); + } + + public static void WriteNamingStylePreferencesToEditorConfig( + ImmutableArray symbolSpecifications, + ImmutableArray namingStyles, + ImmutableArray serializableNamingRules, + string language, + Action entryWriter, + Action? triviaWriter) + { + triviaWriter?.Invoke($"#### {CompilerExtensionsResources.Naming_styles} ####"); var serializedNameMap = AssignNamesToNamingStyleElements(symbolSpecifications, namingStyles); var ruleNameMap = AssignNamesToNamingStyleRules(serializableNamingRules, serializedNameMap); var referencedElements = new HashSet(); - editorconfig.AppendLine(); - editorconfig.AppendLine($"# {CompilerExtensionsResources.Naming_rules}"); + triviaWriter?.Invoke(""); + triviaWriter?.Invoke($"# {CompilerExtensionsResources.Naming_rules}"); foreach (var namingRule in serializableNamingRules) { referencedElements.Add(namingRule.SymbolSpecificationID); referencedElements.Add(namingRule.NamingStyleID); - editorconfig.AppendLine(); - editorconfig.AppendLine($"dotnet_naming_rule.{ruleNameMap[namingRule]}.severity = {namingRule.EnforcementLevel.ToNotificationOption(defaultSeverity: DiagnosticSeverity.Hidden).ToEditorConfigString()}"); - editorconfig.AppendLine($"dotnet_naming_rule.{ruleNameMap[namingRule]}.symbols = {serializedNameMap[namingRule.SymbolSpecificationID]}"); - editorconfig.AppendLine($"dotnet_naming_rule.{ruleNameMap[namingRule]}.style = {serializedNameMap[namingRule.NamingStyleID]}"); + triviaWriter?.Invoke(""); + entryWriter($"dotnet_naming_rule.{ruleNameMap[namingRule]}.severity", namingRule.EnforcementLevel.ToNotificationOption(defaultSeverity: DiagnosticSeverity.Hidden).ToEditorConfigString()); + entryWriter($"dotnet_naming_rule.{ruleNameMap[namingRule]}.symbols", serializedNameMap[namingRule.SymbolSpecificationID]); + entryWriter($"dotnet_naming_rule.{ruleNameMap[namingRule]}.style", serializedNameMap[namingRule.NamingStyleID]); } - editorconfig.AppendLine(); - editorconfig.AppendLine($"# {CompilerExtensionsResources.Symbol_specifications}"); + triviaWriter?.Invoke(""); + triviaWriter?.Invoke($"# {CompilerExtensionsResources.Symbol_specifications}"); foreach (var symbolSpecification in symbolSpecifications) { @@ -63,14 +80,14 @@ public static void AppendNamingStylePreferencesToEditorConfig( continue; } - editorconfig.AppendLine(); - editorconfig.AppendLine($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.applicable_kinds = {symbolSpecification.ApplicableSymbolKindList.ToEditorConfigString()}"); - editorconfig.AppendLine($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.applicable_accessibilities = {symbolSpecification.ApplicableAccessibilityList.ToEditorConfigString(language)}"); - editorconfig.AppendLine($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.required_modifiers = {symbolSpecification.RequiredModifierList.ToEditorConfigString(language)}"); + triviaWriter?.Invoke(""); + entryWriter($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.applicable_kinds", symbolSpecification.ApplicableSymbolKindList.ToEditorConfigString()); + entryWriter($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.applicable_accessibilities", symbolSpecification.ApplicableAccessibilityList.ToEditorConfigString(language)); + entryWriter($"dotnet_naming_symbols.{serializedNameMap[symbolSpecification.ID]}.required_modifiers", symbolSpecification.RequiredModifierList.ToEditorConfigString(language)); } - editorconfig.AppendLine(); - editorconfig.AppendLine($"# {CompilerExtensionsResources.Naming_styles}"); + triviaWriter?.Invoke(""); + triviaWriter?.Invoke($"# {CompilerExtensionsResources.Naming_styles}"); foreach (var namingStyle in namingStyles) { @@ -79,11 +96,11 @@ public static void AppendNamingStylePreferencesToEditorConfig( continue; } - editorconfig.AppendLine(); - editorconfig.AppendLine($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.required_prefix = {namingStyle.Prefix}"); - editorconfig.AppendLine($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.required_suffix = {namingStyle.Suffix}"); - editorconfig.AppendLine($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.word_separator = {namingStyle.WordSeparator}"); - editorconfig.AppendLine($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.capitalization = {namingStyle.CapitalizationScheme.ToEditorConfigString()}"); + triviaWriter?.Invoke(""); + entryWriter($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.required_prefix", namingStyle.Prefix); + entryWriter($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.required_suffix", namingStyle.Suffix); + entryWriter($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.word_separator", namingStyle.WordSeparator); + entryWriter($"dotnet_naming_style.{serializedNameMap[namingStyle.ID]}.capitalization", namingStyle.CapitalizationScheme.ToEditorConfigString()); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/AbstractSimplification.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/AbstractSimplification.cs index 77c93a2aef321..54f2939652cbd 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/AbstractSimplification.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/AbstractSimplification.cs @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.Simplification; @@ -14,5 +9,5 @@ namespace Microsoft.CodeAnalysis.Simplification; internal abstract class AbstractSimplification : ISimplification { public abstract SimplifierOptions DefaultOptions { get; } - public abstract SimplifierOptions GetSimplifierOptions(IOptionsReader options, SimplifierOptions? fallbackOptions); + public abstract SimplifierOptions GetSimplifierOptions(IOptionsReader options); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/ISimplification.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/ISimplification.cs index 367ea4be74965..22d9d03149504 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/ISimplification.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/ISimplification.cs @@ -10,5 +10,5 @@ namespace Microsoft.CodeAnalysis.Simplification; internal interface ISimplification { SimplifierOptions DefaultOptions { get; } - SimplifierOptions GetSimplifierOptions(IOptionsReader options, SimplifierOptions? fallbackOptions); + SimplifierOptions GetSimplifierOptions(IOptionsReader options); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/SimplifierOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/SimplifierOptions.cs index 9d758291163c6..db49116604628 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/SimplifierOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Simplification/SimplifierOptions.cs @@ -75,16 +75,13 @@ internal interface SimplifierOptionsProvider internal static partial class SimplifierOptionsProviders { #if !CODE_STYLE - public static SimplifierOptions GetSimplifierOptions(this IOptionsReader options, LanguageServices languageServices, SimplifierOptions? fallbackOptions) - => languageServices.GetService()?.GetSimplifierOptions(options, fallbackOptions) ?? fallbackOptions ?? SimplifierOptions.CommonDefaults; + public static SimplifierOptions GetSimplifierOptions(this IOptionsReader options, LanguageServices languageServices) + => languageServices.GetService()?.GetSimplifierOptions(options) ?? SimplifierOptions.CommonDefaults; - public static async ValueTask GetSimplifierOptionsAsync(this Document document, SimplifierOptions? fallbackOptions, CancellationToken cancellationToken) + public static async ValueTask GetSimplifierOptionsAsync(this Document document, CancellationToken cancellationToken) { var configOptions = await document.GetAnalyzerConfigOptionsAsync(cancellationToken).ConfigureAwait(false); - return configOptions.GetSimplifierOptions(document.Project.Services, fallbackOptions); + return configOptions.GetSimplifierOptions(document.Project.Services); } - - public static async ValueTask GetSimplifierOptionsAsync(this Document document, SimplifierOptionsProvider fallbackOptionsProvider, CancellationToken cancellationToken) - => await document.GetSimplifierOptionsAsync(await fallbackOptionsProvider.GetOptionsAsync(document.Project.Services, cancellationToken).ConfigureAwait(false), cancellationToken).ConfigureAwait(false); #endif } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Simplification/VisualBasicSimplification.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Simplification/VisualBasicSimplification.vb index 615dbb44f66a3..7eb08356f3d1f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Simplification/VisualBasicSimplification.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Simplification/VisualBasicSimplification.vb @@ -18,8 +18,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification End Get End Property - Public Overrides Function GetSimplifierOptions(options As IOptionsReader, fallbackOptions As SimplifierOptions) As SimplifierOptions - Return New VisualBasicSimplifierOptions(options, If(DirectCast(fallbackOptions, VisualBasicSimplifierOptions), VisualBasicSimplifierOptions.Default)) + Public Overrides Function GetSimplifierOptions(options As IOptionsReader) As SimplifierOptions + Return New VisualBasicSimplifierOptions(options, fallbackOptions:=Nothing) End Function End Class End Namespace diff --git a/src/Workspaces/VisualBasic/Portable/Simplification/VisualBasicSimplificationService.vb b/src/Workspaces/VisualBasic/Portable/Simplification/VisualBasicSimplificationService.vb index 9246a9f11d22e..1b43d7563f8a2 100644 --- a/src/Workspaces/VisualBasic/Portable/Simplification/VisualBasicSimplificationService.vb +++ b/src/Workspaces/VisualBasic/Portable/Simplification/VisualBasicSimplificationService.vb @@ -44,8 +44,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification End Get End Property - Public Overrides Function GetSimplifierOptions(options As IOptionsReader, fallbackOptions As SimplifierOptions) As SimplifierOptions - Return New VisualBasicSimplifierOptions(options, If(DirectCast(fallbackOptions, VisualBasicSimplifierOptions), VisualBasicSimplifierOptions.Default)) + Public Overrides Function GetSimplifierOptions(options As IOptionsReader) As SimplifierOptions + Return New VisualBasicSimplifierOptions(options, fallbackOptions:=Nothing) End Function Public Overrides Function Expand(node As SyntaxNode, semanticModel As SemanticModel, aliasReplacementAnnotation As SyntaxAnnotation, expandInsideNode As Func(Of SyntaxNode, Boolean), expandParameter As Boolean, cancellationToken As CancellationToken) As SyntaxNode