From ecd334800f8bb47ce93a9ec98269b46d57059eed Mon Sep 17 00:00:00 2001 From: tmat Date: Thu, 11 Jul 2024 13:23:49 -0700 Subject: [PATCH] MemberDisplayOptions --- .../CodeActions/AddUsing/AddUsingTests.cs | 2 +- .../Controller.Session_ComputeModel.cs | 4 +- .../AbstractAddImportsPasteCommandHandler.cs | 10 +--- ...AddMissingImportsFeatureServiceAccessor.cs | 32 ++++------- .../AbstractCodeActionOrUserDiagnosticTest.cs | 9 +-- ...agnosticProviderBasedUserDiagnosticTest.cs | 8 +-- .../Diagnostics/AbstractUserDiagnosticTest.cs | 3 +- .../Test/Options/GlobalOptionsTests.cs | 2 +- .../SignatureHelpControllerTests.vb | 10 ++-- .../AbstractCompletionProviderTests.cs | 2 +- .../AbstractSignatureHelpProviderTests.cs | 13 +++-- .../GenerateConstructorFromMembersTests.vb | 3 +- .../CrefCompletionProvider.cs | 4 +- ...mAndCompletionListTagCompletionProvider.cs | 2 +- .../PropertySubPatternCompletionProvider.cs | 2 +- .../AttributeSignatureHelpProvider.cs | 3 +- ...tructorInitializerSignatureHelpProvider.cs | 2 +- ...ntAccessExpressionSignatureHelpProvider.cs | 2 +- .../GenericNameSignatureHelpProvider.cs | 2 +- ...tializerExpressionSignatureHelpProvider.cs | 2 +- ...vocationExpressionSignatureHelpProvider.cs | 2 +- ...CreationExpressionSignatureHelpProvider.cs | 2 +- ...onstructorBaseTypeSignatureHelpProvider.cs | 2 +- .../TupleConstructionSignatureHelpProvider.cs | 2 +- .../FullyQualify/FullyQualifyTests.cs | 2 +- .../AbstractAddImportCodeFixProvider.cs | 7 +-- .../Portable/AddImport/AddImportOptions.cs | 36 ++++++++++++ .../AddImport/IAddImportFeatureService.cs | 6 -- .../AddImport/SymbolReferenceFinder.cs | 2 +- ...AbstractAddMissingImportsFeatureService.cs | 20 +++---- ...actAddMissingImportsRefactoringProvider.cs | 24 +------- .../IAddMissingImportsFeatureService.cs | 17 ++---- .../Portable/Completion/CompletionOptions.cs | 4 +- .../AbstractCrefCompletionProvider.cs | 6 +- ...bstractObjectCreationCompletionProvider.cs | 2 +- ...ractObjectInitializerCompletionProvider.cs | 2 +- ...ExtensionMethodImportCompletionProvider.cs | 2 +- .../AbstractTypeImportCompletionService.cs | 2 +- .../VSTypeScriptSignatureHelpProviderBase.cs | 3 +- .../Core/Portable/FeaturesResources.resx | 6 ++ .../AbstractFullyQualifyCodeFixProvider.cs | 3 +- .../AbstractFullyQualifyService.cs | 12 ++-- .../FullyQualify/IFullyQualifyService.cs | 2 +- .../IRemoteFullyQualifyService.cs | 2 +- .../EditorConfigOptionsEnumerator.cs | 8 +-- .../Portable/Options/MemberDisplayOptions.cs | 55 +++++++++++++++++++ .../Options/MemberDisplayOptionsStorage.cs | 26 --------- .../AbstractSignatureHelpProvider.cs | 5 +- .../CommonSignatureHelpUtilities.cs | 3 +- .../SignatureHelp/ISignatureHelpProvider.cs | 3 +- .../SignatureHelp/SignatureHelpOptions.cs | 20 ------- .../SignatureHelp/SignatureHelpService.cs | 6 +- .../AbstractSpellCheckCodeFixProvider.cs | 5 +- .../Portable/xlf/FeaturesResources.cs.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.de.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.es.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.fr.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.it.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.ja.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.ko.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.pl.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.pt-BR.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.ru.xlf | 10 ++++ .../Portable/xlf/FeaturesResources.tr.xlf | 10 ++++ .../xlf/FeaturesResources.zh-Hans.xlf | 10 ++++ .../xlf/FeaturesResources.zh-Hant.xlf | 10 ++++ .../CompletionListTagCompletionProvider.vb | 2 +- .../EnumCompletionProvider.vb | 2 +- ...tIntrinsicOperatorSignatureHelpProvider.vb | 2 +- .../AttributeSignatureHelpProvider.vb | 2 +- ...lectionInitializerSignatureHelpProvider.vb | 2 +- ...unctionAggregationSignatureHelpProvider.vb | 2 +- .../GenericNameSignatureHelpProvider.vb | 2 +- ...vocationExpressionSignatureHelpProvider.vb | 2 +- ...ressionSignatureHelpProvider.NormalType.vb | 2 +- ...CreationExpressionSignatureHelpProvider.vb | 2 +- ...aiseEventStatementSignatureHelpProvider.vb | 2 +- .../Options/CodeActionOptionsStorage.cs | 1 - .../Options/CompletionOptionsStorage.cs | 2 +- .../Options/SignatureHelpOptionsStorage.cs | 16 ------ .../SignatureHelp/SignatureHelpHandler.cs | 24 ++------ .../Razor/Cohost/Handlers/SignatureHelp.cs | 3 +- .../BasicEditorConfigGeneratorTests.vb | 10 ++++ .../CSharpEditorConfigGeneratorTests.vb | 10 ++++ .../FSharpSignatureHelpProvider.cs | 2 +- .../FullyQualify/RemoteFullyQualifyService.cs | 4 +- .../Core/CodeFixes/CodeActionOptions.cs | 1 - 87 files changed, 377 insertions(+), 264 deletions(-) create mode 100644 src/Features/Core/Portable/AddImport/AddImportOptions.cs create mode 100644 src/Features/Core/Portable/Options/MemberDisplayOptions.cs delete mode 100644 src/Features/Core/Portable/Options/MemberDisplayOptionsStorage.cs delete mode 100644 src/Features/Core/Portable/SignatureHelp/SignatureHelpOptions.cs delete mode 100644 src/LanguageServer/Protocol/Features/Options/SignatureHelpOptionsStorage.cs diff --git a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs index fd54a8e22b827..032c2506eb394 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/AddUsing/AddUsingTests.cs @@ -6365,7 +6365,7 @@ static void Main(string[] args) "; await TestMissingAsync(initialWorkspace, new TestParameters( - globalOptions: Option(MemberDisplayOptionsStorage.HideAdvancedMembers, true), + options: Option(MemberDisplayOptionsStorage.HideAdvancedMembers, true), testHost: testHost)); } diff --git a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs index 13933d4173af1..2b81547c9eac5 100644 --- a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs +++ b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.VisualStudio.Text; @@ -82,15 +83,12 @@ private async Task ComputeModelInBackgroundAsync( } } - var options = Controller.GlobalOptions.GetSignatureHelpOptions(document.Project.Language); - // first try to query the providers that can trigger on the specified character var (provider, items) = await SignatureHelpService.GetSignatureHelpAsync( providers, document, caretPosition, triggerInfo, - options, cancellationToken).ConfigureAwait(false); if (provider == null) diff --git a/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs b/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs index 10398fc40f1ca..4f89fe2ee33e7 100644 --- a/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs +++ b/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs @@ -151,16 +151,10 @@ private async Task ExecuteAsync(Document document, SnapshotSpan snapshotSpan, IT await TaskScheduler.Default; var addMissingImportsService = document.GetRequiredLanguageService(); - - var cleanupOptions = await document.GetCodeCleanupOptionsAsync(cancellationToken).ConfigureAwait(false); - - var options = new AddMissingImportsOptions( - CleanupOptions: cleanupOptions, - HideAdvancedMembers: _globalOptions.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, document.Project.Language)); - var textSpan = snapshotSpan.Span.ToTextSpan(); + var updatedDocument = await addMissingImportsService.AddMissingImportsAsync( - document, textSpan, options, backgroundWorkContext.GetCodeAnalysisProgress(), cancellationToken).ConfigureAwait(false); + document, textSpan, backgroundWorkContext.GetCodeAnalysisProgress(), cancellationToken).ConfigureAwait(false); if (updatedDocument is null) { diff --git a/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs b/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs index 313c9c6a45bb8..7edac5eed6e1e 100644 --- a/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs +++ b/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs @@ -7,9 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.AddMissingImports; -using Microsoft.CodeAnalysis.CodeCleanup; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -19,45 +17,35 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTestGenerator.Api; [Shared] [method: ImportingConstructor] [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] -internal class UnitTestGeneratorAddMissingImportsFeatureServiceAccessor(IGlobalOptionService globalOptions) +internal class UnitTestGeneratorAddMissingImportsFeatureServiceAccessor() { - private readonly IGlobalOptionService _globalOptions = globalOptions; - +#pragma warning disable CA1822 // Mark members as static internal async Task AddMissingImportsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) +#pragma warning restore CA1822 { - var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); var service = document.Project.GetRequiredLanguageService(); // Unfortunately, the unit testing system doesn't have a way to report progress. - return await service.AddMissingImportsAsync(document, textSpan, options, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); + return await service.AddMissingImportsAsync(document, textSpan, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); } +#pragma warning disable CA1822 // Mark members as static internal async Task AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) +#pragma warning restore CA1822 { - var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); var service = document.Project.GetRequiredLanguageService(); - var result = await service.AnalyzeAsync(document, textSpan, options, cancellationToken).ConfigureAwait(false); + var result = await service.AnalyzeAsync(document, textSpan, cancellationToken).ConfigureAwait(false); return new WrappedMissingImportsAnalysisResult(result.AddImportFixData.SelectAsArray(data => new WrappedAddImportFixData(data))); } +#pragma warning disable CA1822 // Mark members as static internal async Task AddMissingImportsAsync(Document document, WrappedMissingImportsAnalysisResult analysisResult, CancellationToken cancellationToken) +#pragma warning restore CA1822 { - var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); var service = document.Project.GetRequiredLanguageService(); var unwrappedResult = new AddMissingImportsAnalysisResult(analysisResult.AddImportFixDatas.SelectAsArray(result => result.Underlying)); // Unfortunately, the unit testing system doesn't have a way to report progress. - return await service.AddMissingImportsAsync(document, unwrappedResult, options.CleanupOptions.FormattingOptions, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); - } - - private async Task GetOptionsAsync(Document document, CancellationToken cancellationToken) - { - var cleanupOptions = await document.GetCodeCleanupOptionsAsync(cancellationToken).ConfigureAwait(false); - - var options = new AddMissingImportsOptions( - CleanupOptions: cleanupOptions, - HideAdvancedMembers: _globalOptions.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, document.Project.Language)); - - return options; + return await service.AddMissingImportsAsync(document, unwrappedResult, CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false); } } diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs index e5f84bc80ebb2..aa7e59b651a1b 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs @@ -110,9 +110,6 @@ public TestParameters WithCompilationOptions(CompilationOptions compilationOptio internal TestParameters WithOptions(OptionsCollectionAlias options) => new(parseOptions, compilationOptions, options, globalOptions, fixProviderData, index, priority, retainNonFixableDiagnostics, includeDiagnosticsOutsideSelection, title, testHost, workspaceKind, includeNonLocalDocumentDiagnostics, treatPositionIndicatorsAsCode); - internal TestParameters WithGlobalOptions(OptionsCollectionAlias globalOptions) - => new(parseOptions, compilationOptions, options, globalOptions, fixProviderData, index, priority, retainNonFixableDiagnostics, includeDiagnosticsOutsideSelection, title, testHost, workspaceKind, includeNonLocalDocumentDiagnostics, treatPositionIndicatorsAsCode); - public TestParameters WithFixProviderData(object fixProviderData) => new(parseOptions, compilationOptions, options, globalOptions, fixProviderData, index, priority, retainNonFixableDiagnostics, includeDiagnosticsOutsideSelection, title, testHost, workspaceKind, includeNonLocalDocumentDiagnostics, treatPositionIndicatorsAsCode); @@ -408,7 +405,6 @@ internal Task TestInRegularAndScriptAsync( CodeActionPriority? priority = null, CompilationOptions compilationOptions = null, OptionsCollectionAlias options = null, - OptionsCollectionAlias globalOptions = null, object fixProviderData = null, ParseOptions parseOptions = null, string title = null, @@ -416,7 +412,7 @@ internal Task TestInRegularAndScriptAsync( { return TestInRegularAndScript1Async( initialMarkup, expectedMarkup, - new TestParameters(parseOptions, compilationOptions, options, globalOptions, fixProviderData, index, priority, title: title, testHost: testHost)); + new TestParameters(parseOptions, compilationOptions, options, globalOptions: null, fixProviderData, index, priority, title: title, testHost: testHost)); } internal Task TestInRegularAndScript1Async( @@ -449,7 +445,6 @@ internal Task TestAsync( CompilationOptions compilationOptions = null, int index = 0, OptionsCollectionAlias options = null, - OptionsCollectionAlias globalOptions = null, object fixProviderData = null, CodeActionPriority? priority = null, TestHost testHost = TestHost.OutOfProcess) @@ -457,7 +452,7 @@ internal Task TestAsync( return TestAsync( initialMarkup, expectedMarkup, - new TestParameters(parseOptions, compilationOptions, options, globalOptions, fixProviderData, index, priority, testHost: testHost)); + new TestParameters(parseOptions, compilationOptions, options, globalOptions: null, fixProviderData, index, priority, testHost: testHost)); } private async Task TestAsync( diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs index 5a044fb3afc8a..b7684b5dfcc13 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs @@ -191,11 +191,10 @@ private protected async Task TestDiagnosticInfoAsync( string diagnosticId, DiagnosticSeverity diagnosticSeverity, OptionsCollectionAlias options = null, - OptionsCollectionAlias globalOptions = null, LocalizableString diagnosticMessage = null) { - await TestDiagnosticInfoAsync(initialMarkup, parseOptions: null, compilationOptions: null, options, globalOptions, diagnosticId, diagnosticSeverity, diagnosticMessage); - await TestDiagnosticInfoAsync(initialMarkup, GetScriptOptions(), compilationOptions: null, options, globalOptions, diagnosticId, diagnosticSeverity, diagnosticMessage); + await TestDiagnosticInfoAsync(initialMarkup, parseOptions: null, compilationOptions: null, options, diagnosticId, diagnosticSeverity, diagnosticMessage); + await TestDiagnosticInfoAsync(initialMarkup, GetScriptOptions(), compilationOptions: null, options, diagnosticId, diagnosticSeverity, diagnosticMessage); } private protected async Task TestDiagnosticInfoAsync( @@ -203,12 +202,11 @@ private protected async Task TestDiagnosticInfoAsync( ParseOptions parseOptions, CompilationOptions compilationOptions, OptionsCollectionAlias options, - OptionsCollectionAlias globalOptions, string diagnosticId, DiagnosticSeverity diagnosticSeverity, LocalizableString diagnosticMessage = null) { - var testOptions = new TestParameters(parseOptions, compilationOptions, options: options, globalOptions: globalOptions); + var testOptions = new TestParameters(parseOptions, compilationOptions, options: options); using var workspace = CreateWorkspaceFromOptions(initialMarkup, testOptions); var diagnostics = (await GetDiagnosticsAsync(workspace, testOptions)).ToImmutableArray(); diagnostics = diagnostics.WhereAsArray(d => d.Id == diagnosticId); diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs index cd94b06d7abad..ce53456df18be 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs @@ -230,12 +230,11 @@ private protected Task TestActionCountInAllFixesAsync( ParseOptions parseOptions = null, CompilationOptions compilationOptions = null, OptionsCollectionAlias options = null, - OptionsCollectionAlias globalOptions = null, object fixProviderData = null) { return TestActionCountInAllFixesAsync( initialMarkup, - new TestParameters(parseOptions, compilationOptions, options, globalOptions, fixProviderData), + new TestParameters(parseOptions, compilationOptions, options, globalOptions: null, fixProviderData), count); } diff --git a/src/EditorFeatures/Test/Options/GlobalOptionsTests.cs b/src/EditorFeatures/Test/Options/GlobalOptionsTests.cs index 56acfd9b77965..5a5e8cfa07873 100644 --- a/src/EditorFeatures/Test/Options/GlobalOptionsTests.cs +++ b/src/EditorFeatures/Test/Options/GlobalOptionsTests.cs @@ -192,7 +192,7 @@ public void ReadingOptionsFromGlobalOptions(string language) VerifyDataMembersHaveNonDefaultValues(globalOptions.GetDocumentationCommentOptions(globalOptions.GetLineFormattingOptions(language), language), DocumentationCommentOptions.Default, language); VerifyDataMembersHaveNonDefaultValues(globalOptions.GetImplementTypeOptions(language), ImplementTypeOptions.Default, language); VerifyDataMembersHaveNonDefaultValues(globalOptions.GetMetadataAsSourceOptions(), MetadataAsSourceOptions.Default, language); - VerifyDataMembersHaveNonDefaultValues(globalOptions.GetSignatureHelpOptions(language), SignatureHelpOptions.Default, language); + VerifyDataMembersHaveNonDefaultValues(globalOptions.GetMemberDisplayOptions(language), MemberDisplayOptions.Default, language); VerifyDataMembersHaveNonDefaultValues(globalOptions.GetSymbolSearchOptions(language), SymbolSearchOptions.Default, language); VerifyDataMembersHaveNonDefaultValues(globalOptions.GetWorkspaceConfigurationOptions(), WorkspaceConfigurationOptions.Default); } diff --git a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb index cd890271bb414..21e47ea01dc99 100644 --- a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb +++ b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb @@ -80,7 +80,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public Sub UpKeyShouldNotCrashWhenSessionIsDismissed() - Dim options = New SignatureHelpOptions() + Dim options = New MemberDisplayOptions() ' Create a provider that will return an empty state when queried the second time Dim slowProvider = New Mock(Of ISignatureHelpProvider)(MockBehavior.Strict) @@ -108,7 +108,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public Sub DownKeyShouldNotBlockOnModelComputation() - Dim options = New SignatureHelpOptions() + Dim options = New MemberDisplayOptions() Dim mre = New ManualResetEvent(False) Dim controller = CreateController(CreateWorkspace(), items:=CreateItems(2), waitForPresentation:=False) Dim slowProvider = New Mock(Of ISignatureHelpProvider)(MockBehavior.Strict) @@ -128,7 +128,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public Sub UpKeyShouldNotBlockOnModelComputation() - Dim options = New SignatureHelpOptions() + Dim options = New MemberDisplayOptions() Dim mre = New ManualResetEvent(False) Dim controller = CreateController(CreateWorkspace(), items:=CreateItems(2), waitForPresentation:=False) Dim slowProvider = New Mock(Of ISignatureHelpProvider)(MockBehavior.Strict) @@ -148,7 +148,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public Async Function UpKeyShouldBlockOnRecomputationAfterPresentation() As Task - Dim options = New SignatureHelpOptions() + Dim options = New MemberDisplayOptions() Dim workspace = CreateWorkspace() Dim threadingContext = workspace.GetService(Of IThreadingContext)() @@ -352,7 +352,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public Property GetItemsCount As Integer - Public Function GetItemsAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Implements ISignatureHelpProvider.GetItemsAsync + Public Function GetItemsAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Implements ISignatureHelpProvider.GetItemsAsync GetItemsCount += 1 Return Task.FromResult(If(_items.Any(), New SignatureHelpItems(_items, TextSpan.FromBounds(position, position), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing), diff --git a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs index f7cb89eafdcb4..95b88de1d19e4 100644 --- a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs @@ -70,7 +70,7 @@ private CompletionOptions GetCompletionOptions() options = options with { ForceExpandedCompletionIndexCreation = ForceExpandedCompletionIndexCreation.Value }; if (HideAdvancedMembers.HasValue) - options = options with { HideAdvancedMembers = HideAdvancedMembers.Value }; + options = options with { MemberDisplayOptions = new() { HideAdvancedMembers = HideAdvancedMembers.Value } }; if (ShowNameSuggestions.HasValue) options = options with { ShowNameSuggestions = ShowNameSuggestions.Value }; diff --git a/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs b/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs index b1b66c31213ae..225d2a46e9992 100644 --- a/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Presentation; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.CodeAnalysis.Test.Utilities; @@ -72,7 +73,7 @@ private async Task TestSignatureHelpWorkerAsync( bool usePreviousCharAsTrigger = false) { using var workspaceFixture = GetOrCreateWorkspaceFixture(); - var options = new SignatureHelpOptions(); + var options = new MemberDisplayOptions(); markupWithPositionAndOptSpan = markupWithPositionAndOptSpan.NormalizeLineEndings(); @@ -155,7 +156,7 @@ protected virtual async Task VerifyCurrentParameterNameAsync(string markup, stri } } - private static async Task GetArgumentStateAsync(int cursorPosition, Document document, ISignatureHelpProvider signatureHelpProvider, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options) + private static async Task GetArgumentStateAsync(int cursorPosition, Document document, ISignatureHelpProvider signatureHelpProvider, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options) { var items = await signatureHelpProvider.GetItemsAsync(document, cursorPosition, triggerInfo, options, CancellationToken.None); return items == null ? null : new SignatureHelpState(items.ArgumentIndex, items.ArgumentCount, items.ArgumentName, argumentNames: default); @@ -172,7 +173,7 @@ private async Task VerifyCurrentParameterNameWorkerAsync(string markup, string e var signatureHelpProviderType = GetSignatureHelpProviderType(); var signatureHelpProvider = workspaceFixture.Target.GetWorkspace().ExportProvider.GetExportedValues().Single(provider => provider.GetType() == signatureHelpProviderType); var triggerInfo = new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand); - var options = new SignatureHelpOptions(); + var options = new MemberDisplayOptions(); _ = await signatureHelpProvider.GetItemsAsync(document, cursorPosition, triggerInfo, options, CancellationToken.None); Assert.Equal(expectedParameterName, (await GetArgumentStateAsync(cursorPosition, document, signatureHelpProvider, triggerInfo, options)).Value.ArgumentName); @@ -348,7 +349,7 @@ protected async Task VerifyItemWithReferenceWorkerAsync(string xmlString, IEnume var documentId = testWorkspace.Documents.First(d => d.Name == "SourceDocument").Id; var document = testWorkspace.CurrentSolution.GetDocument(documentId); - var options = new SignatureHelpOptions() with { HideAdvancedMembers = hideAdvancedMembers }; + var options = new MemberDisplayOptions() with { HideAdvancedMembers = hideAdvancedMembers }; document = testWorkspace.CurrentSolution.GetDocument(documentId); var code = (await document.GetTextAsync()).ToString(); @@ -374,7 +375,7 @@ private async Task TestSignatureHelpWorkerSharedAsync( string code, int cursorPosition, Document document, - SignatureHelpOptions options, + MemberDisplayOptions options, TextSpan? textSpan, IEnumerable expectedOrderedItemsOrNull = null, bool usePreviousCharAsTrigger = false) @@ -467,7 +468,7 @@ protected async Task TestSignatureHelpWithMscorlib45Async( var documentId = testWorkspace.Documents.Where(d => d.Name == "SourceDocument").Single().Id; var document = testWorkspace.CurrentSolution.GetDocument(documentId); var code = (await document.GetTextAsync()).ToString(); - var options = new SignatureHelpOptions(); + var options = new MemberDisplayOptions(); IList textSpans = null; diff --git a/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb b/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb index 672cf57893baf..2f1e08d9e6c8f 100644 --- a/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb +++ b/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb @@ -368,8 +368,7 @@ End Class", chosenSymbols:={"i"}) Dim options = New OptionsCollection(LanguageNames.VisualBasic) options.Add(LegacyGlobalOptionsWorkspaceService.s_addNullChecks, True) - Dim parameters = New TestParameters() - parameters = parameters.WithGlobalOptions(options) + Dim parameters = New TestParameters(globalOptions:=options) Await TestWithPickMembersDialogAsync( "Class Program diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs index 6c6e82d0aff67..ece9c7366acb3 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs @@ -75,7 +75,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context) var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); var span = GetCompletionItemSpan(text, position); - var serializedOptions = ImmutableArray.Create(KeyValuePairUtil.Create(HideAdvancedMembers, options.HideAdvancedMembers.ToString())); + var serializedOptions = ImmutableArray.Create(KeyValuePairUtil.Create(HideAdvancedMembers, options.MemberDisplayOptions.HideAdvancedMembers.ToString())); var items = CreateCompletionItems(semanticModel, symbols, token, position, serializedOptions); @@ -107,7 +107,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context) parentNode, cancellationToken).ConfigureAwait(false); var symbols = GetSymbols(token, semanticModel, cancellationToken) - .FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation); + .FilterToVisibleAndBrowsableSymbols(options.MemberDisplayOptions.HideAdvancedMembers, semanticModel.Compilation); return (token, semanticModel, symbols); } diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs index 3b8a512286267..8b9bbcece2b03 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs @@ -154,7 +154,7 @@ private static async Task HandleSingleTypeAsync( type = enumType; } - var hideAdvancedMembers = context.CompletionOptions.HideAdvancedMembers; + var hideAdvancedMembers = context.CompletionOptions.MemberDisplayOptions.HideAdvancedMembers; if (!type.IsEditorBrowsable(hideAdvancedMembers, semanticModel.Compilation)) return; diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/PropertySubPatternCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/PropertySubPatternCompletionProvider.cs index 261a14a72ad27..f102df94d6f9a 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/PropertySubPatternCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/PropertySubPatternCompletionProvider.cs @@ -69,7 +69,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context) // Find the members that can be tested. var members = GetCandidatePropertiesAndFields(document, semanticModel, position, type); - members = members.WhereAsArray(m => m.IsEditorBrowsable(context.CompletionOptions.HideAdvancedMembers, semanticModel.Compilation)); + members = members.WhereAsArray(m => m.IsEditorBrowsable(context.CompletionOptions.MemberDisplayOptions.HideAdvancedMembers, semanticModel.Compilation)); if (memberAccess is null) { diff --git a/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs index cbae266b5700f..49571d808af55 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.DocumentationComments; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.CodeAnalysis.Text; @@ -70,7 +71,7 @@ private static bool IsArgumentListToken(AttributeSyntax expression, SyntaxToken token != expression.ArgumentList.CloseParenToken; } - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!TryGetAttributeExpression(root, position, document.GetRequiredLanguageService(), triggerInfo.TriggerReason, cancellationToken, out var attribute)) diff --git a/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs index 4691e12cadf2c..0bcc89a7e72b3 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs @@ -66,7 +66,7 @@ private static bool IsArgumentListToken(ConstructorInitializerSyntax expression, token != expression.ArgumentList.CloseParenToken; } - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var constructorInitializer = await TryGetConstructorInitializerAsync( document, position, triggerInfo.TriggerReason, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs index 0aa0ec4939dc5..1287c60d4008d 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs @@ -50,7 +50,7 @@ private static bool TryGetElementAccessExpression(SyntaxNode root, int position, ConditionalAccessExpression.TryGetSyntax(root, position, syntaxFacts, triggerReason, cancellationToken, out identifier, out openBrace); } - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!TryGetElementAccessExpression(root, position, document.GetRequiredLanguageService(), triggerInfo.TriggerReason, cancellationToken, out var expression, out var openBrace)) diff --git a/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs index 0f1178ebb16d2..4820e5825e2c8 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs @@ -74,7 +74,7 @@ private bool IsArgumentListToken(GenericNameSyntax node, SyntaxToken token) token != node.TypeArgumentList.GreaterThanToken; } - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!TryGetGenericIdentifier(root, position, document.GetRequiredLanguageService(), triggerInfo.TriggerReason, cancellationToken, diff --git a/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs index f2ca003cd62cd..561d63a3deb02 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs @@ -53,7 +53,7 @@ private bool IsTriggerToken(SyntaxToken token) private static bool IsInitializerExpressionToken(InitializerExpressionSyntax expression, SyntaxToken token) => expression.Span.Contains(token.SpanStart) && token != expression.CloseBraceToken; - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!TryGetInitializerExpression(root, position, document.GetRequiredLanguageService(), triggerInfo.TriggerReason, cancellationToken, out var initializerExpression)) diff --git a/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs index a19398ff193ae..d2313fa99f18e 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs @@ -66,7 +66,7 @@ private static bool IsArgumentListToken(InvocationExpressionSyntax expression, S Document document, int position, SignatureHelpTriggerInfo triggerInfo, - SignatureHelpOptions options, + MemberDisplayOptions options, CancellationToken cancellationToken) { var invocationExpression = await TryGetInvocationExpressionAsync( diff --git a/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs index bfa6cb523d8fe..371f5ceada59b 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs @@ -64,7 +64,7 @@ private static bool IsArgumentListToken(BaseObjectCreationExpressionSyntax expre token != expression.ArgumentList.CloseParenToken; } - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var objectCreationExpression = await TryGetObjectCreationExpressionAsync( diff --git a/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs index ae39a94cae52d..aac5a3620d443 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs @@ -67,7 +67,7 @@ static bool IsArgumentListToken(PrimaryConstructorBaseTypeSyntax expression, Syn private bool IsTriggerToken(SyntaxToken token) => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var syntaxFacts = document.GetRequiredLanguageService(); diff --git a/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs index 46e5ea5c11db1..766205edbf442 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs @@ -104,7 +104,7 @@ public override Boolean IsRetriggerCharacter(Char ch) public override Boolean IsTriggerCharacter(Char ch) => ch is '(' or ','; - protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/Features/CSharpTest/FullyQualify/FullyQualifyTests.cs b/src/Features/CSharpTest/FullyQualify/FullyQualifyTests.cs index 93e18762a35d0..0f78f87fde8ce 100644 --- a/src/Features/CSharpTest/FullyQualify/FullyQualifyTests.cs +++ b/src/Features/CSharpTest/FullyQualify/FullyQualifyTests.cs @@ -1656,7 +1656,7 @@ static void Main(string[] args) "; await TestMissingAsync(initialWorkspace, new TestParameters( - globalOptions: Option(MemberDisplayOptionsStorage.HideAdvancedMembers, true), + options: Option(MemberDisplayOptionsStorage.HideAdvancedMembers, true), testHost: testHost)); } } diff --git a/src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs b/src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs index 5c4a5f50a52ab..e1022a0b6262a 100644 --- a/src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs @@ -75,12 +75,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) searchOptions = searchOptions with { SearchNuGetPackages = false }; } - var cleanupOptions = await document.GetCodeCleanupOptionsAsync(cancellationToken).ConfigureAwait(false); - - var addImportOptions = new AddImportOptions( - searchOptions, - cleanupOptions, - codeActionOptions.HideAdvancedMembers); + var addImportOptions = await document.GetAddImportOptionsAsync(searchOptions, cancellationToken).ConfigureAwait(false); var fixesForDiagnostic = await addImportService.GetFixesForDiagnosticsAsync( document, span, diagnostics, MaxResults, symbolSearchService, addImportOptions, packageSources, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/AddImport/AddImportOptions.cs b/src/Features/Core/Portable/AddImport/AddImportOptions.cs new file mode 100644 index 0000000000000..0c2a61e9da59c --- /dev/null +++ b/src/Features/Core/Portable/AddImport/AddImportOptions.cs @@ -0,0 +1,36 @@ +// 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.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeCleanup; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.SymbolSearch; + +namespace Microsoft.CodeAnalysis.AddImport; + +[DataContract] +internal readonly record struct AddImportOptions( + [property: DataMember(Order = 0)] SymbolSearchOptions SearchOptions, + [property: DataMember(Order = 1)] CodeCleanupOptions CleanupOptions, + [property: DataMember(Order = 2)] MemberDisplayOptions MemberDisplayOptions); + +internal static class AddImportOptionsProviders +{ + public static AddImportOptions GetAddImportOptions(this IOptionsReader options, LanguageServices languageServices, SymbolSearchOptions searchOptions, bool allowImportsInHiddenRegions) + => new() + { + SearchOptions = searchOptions, + CleanupOptions = options.GetCodeCleanupOptions(languageServices, allowImportsInHiddenRegions), + MemberDisplayOptions = options.GetMemberDisplayOptions(languageServices.Language) + }; + + public static async ValueTask GetAddImportOptionsAsync(this Document document, SymbolSearchOptions searchOptions, CancellationToken cancellationToken) + { + var configOptions = await document.GetAnalyzerConfigOptionsAsync(cancellationToken).ConfigureAwait(false); + return configOptions.GetAddImportOptions(document.Project.Services, searchOptions, document.AllowImportsInHiddenRegions()); + } +} diff --git a/src/Features/Core/Portable/AddImport/IAddImportFeatureService.cs b/src/Features/Core/Portable/AddImport/IAddImportFeatureService.cs index e9d4a60566d14..6acecd82cae76 100644 --- a/src/Features/Core/Portable/AddImport/IAddImportFeatureService.cs +++ b/src/Features/Core/Portable/AddImport/IAddImportFeatureService.cs @@ -15,12 +15,6 @@ namespace Microsoft.CodeAnalysis.AddImport; -[DataContract] -internal readonly record struct AddImportOptions( - [property: DataMember(Order = 0)] SymbolSearchOptions SearchOptions, - [property: DataMember(Order = 1)] CodeCleanupOptions CleanupOptions, - [property: DataMember(Order = 2)] bool HideAdvancedMembers); - internal interface IAddImportFeatureService : ILanguageService { /// diff --git a/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs b/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs index e5dd1a4a7026d..9755b7d2d1790 100644 --- a/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs +++ b/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs @@ -201,7 +201,7 @@ private async Task> GetReferencesForMatchingType // editor browsable rules. var accessibleTypeSymbols = typeSymbols.WhereAsArray( s => ArityAccessibilityAndAttributeContextAreCorrect(s.Symbol, arity, inAttributeContext, hasIncompleteParentMember, looksGeneric) && - s.Symbol.IsEditorBrowsable(_options.HideAdvancedMembers, _semanticModel.Compilation, editorBrowserInfo)); + s.Symbol.IsEditorBrowsable(_options.MemberDisplayOptions.HideAdvancedMembers, _semanticModel.Compilation, editorBrowserInfo)); // These types may be contained within namespaces, or they may be nested // inside generic types. Record these namespaces/types if it would be diff --git a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsFeatureService.cs b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsFeatureService.cs index 2d2716cbc6e72..a92ebb744720a 100644 --- a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsFeatureService.cs +++ b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsFeatureService.cs @@ -29,25 +29,24 @@ internal abstract class AbstractAddMissingImportsFeatureService : IAddMissingImp protected abstract ImmutableArray GetFormatRules(SourceText text); /// - public async Task AddMissingImportsAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, IProgress progressTracker, CancellationToken cancellationToken) + public async Task AddMissingImportsAsync(Document document, TextSpan textSpan, IProgress progressTracker, CancellationToken cancellationToken) { - var analysisResult = await AnalyzeAsync(document, textSpan, options, cancellationToken).ConfigureAwait(false); + var analysisResult = await AnalyzeAsync(document, textSpan, cancellationToken).ConfigureAwait(false); return await AddMissingImportsAsync( - document, analysisResult, options.CleanupOptions.FormattingOptions, progressTracker, cancellationToken).ConfigureAwait(false); + document, analysisResult, progressTracker, cancellationToken).ConfigureAwait(false); } /// public async Task AddMissingImportsAsync( Document document, AddMissingImportsAnalysisResult analysisResult, - SyntaxFormattingOptions formattingOptions, IProgress progressTracker, CancellationToken cancellationToken) { if (analysisResult.CanAddMissingImports) { // Apply those fixes to the document. - var newDocument = await ApplyFixesAsync(document, analysisResult.AddImportFixData, formattingOptions, progressTracker, cancellationToken).ConfigureAwait(false); + var newDocument = await ApplyFixesAsync(document, analysisResult.AddImportFixData, progressTracker, cancellationToken).ConfigureAwait(false); return newDocument; } @@ -55,7 +54,7 @@ public async Task AddMissingImportsAsync( } /// - public async Task AnalyzeAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken) + public async Task AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { // Get the diagnostics that indicate a missing import. var addImportFeatureService = document.GetRequiredLanguageService(); @@ -66,10 +65,9 @@ public async Task AnalyzeAsync(Document documen // Since we are not currently considering NuGet packages, pass an empty array var packageSources = ImmutableArray.Empty; - var addImportOptions = new AddImportOptions( - SearchOptions: new() { SearchReferenceAssemblies = true, SearchNuGetPackages = false }, - CleanupOptions: options.CleanupOptions, - HideAdvancedMembers: options.HideAdvancedMembers); + var addImportOptions = await document.GetAddImportOptionsAsync( + searchOptions: new() { SearchReferenceAssemblies = true, SearchNuGetPackages = false }, + cancellationToken).ConfigureAwait(false); var unambiguousFixes = await addImportFeatureService.GetUniqueFixesAsync( document, textSpan, FixableDiagnosticIds, symbolSearchService, @@ -91,7 +89,6 @@ private static bool DoesNotAddReference(AddImportFixData fixData, ProjectId curr private async Task ApplyFixesAsync( Document document, ImmutableArray fixes, - SyntaxFormattingOptions formattingOptions, IProgress progressTracker, CancellationToken cancellationToken) { @@ -104,6 +101,7 @@ private async Task ApplyFixesAsync( var textDiffingService = solution.Services.GetRequiredService(); var packageInstallerService = solution.Services.GetService(); var addImportService = document.GetRequiredLanguageService(); + var formattingOptions = await document.GetSyntaxFormattingOptionsAsync(cancellationToken).ConfigureAwait(false); // Do not limit the results since we plan to fix all the reported issues. var codeActions = addImportService.GetCodeActionsForFixes(document, fixes, packageInstallerService, maxResults: int.MaxValue); diff --git a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsRefactoringProvider.cs b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsRefactoringProvider.cs index 1c6ae905ebebc..033d48fceff61 100644 --- a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsRefactoringProvider.cs +++ b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/AbstractAddMissingImportsRefactoringProvider.cs @@ -42,12 +42,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte // Check pasted text span for missing imports var addMissingImportsService = document.GetRequiredLanguageService(); - var cleanupOptions = await document.GetCodeCleanupOptionsAsync(cancellationToken).ConfigureAwait(false); - var options = new AddMissingImportsOptions( - cleanupOptions, - context.Options.GetOptions(document.Project.Services).HideAdvancedMembers); - - var analysis = await addMissingImportsService.AnalyzeAsync(document, textSpan, options, cancellationToken).ConfigureAwait(false); + var analysis = await addMissingImportsService.AnalyzeAsync(document, textSpan, cancellationToken).ConfigureAwait(false); if (!analysis.CanAddMissingImports) { return; @@ -55,23 +50,10 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte var addImportsCodeAction = CodeAction.Create( CodeActionTitle, - (progressTracker, cancellationToken) => AddMissingImportsAsync( - document, addMissingImportsService, analysis, options.CleanupOptions.FormattingOptions, progressTracker, cancellationToken), + async (progressTracker, cancellationToken) => + (await addMissingImportsService.AddMissingImportsAsync(document, analysis, progressTracker, cancellationToken).ConfigureAwait(false)).Project.Solution, CodeActionTitle); context.RegisterRefactoring(addImportsCodeAction, textSpan); } - - private static async Task AddMissingImportsAsync( - Document document, - IAddMissingImportsFeatureService addMissingImportsService, - AddMissingImportsAnalysisResult analysis, - SyntaxFormattingOptions formattingOptions, - IProgress progressTracker, - CancellationToken cancellationToken) - { - var modifiedDocument = await addMissingImportsService.AddMissingImportsAsync( - document, analysis, formattingOptions, progressTracker, cancellationToken).ConfigureAwait(false); - return modifiedDocument.Project.Solution; - } } diff --git a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/IAddMissingImportsFeatureService.cs b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/IAddMissingImportsFeatureService.cs index 99c6f34963218..3135aab8195ca 100644 --- a/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/IAddMissingImportsFeatureService.cs +++ b/src/Features/Core/Portable/CodeRefactorings/AddMissingImports/IAddMissingImportsFeatureService.cs @@ -3,21 +3,13 @@ // See the LICENSE file in the project root for more information. using System; -using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CodeCleanup; -using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.AddMissingImports; -[DataContract] -internal readonly record struct AddMissingImportsOptions( - [property: DataMember(Order = 0)] CodeCleanupOptions CleanupOptions, - [property: DataMember(Order = 1)] bool HideAdvancedMembers); - internal interface IAddMissingImportsFeatureService : ILanguageService { /// @@ -26,17 +18,16 @@ internal interface IAddMissingImportsFeatureService : ILanguageService /// if there are ambiguous imports, no known resolutions to import, or if no imports that would be provided /// would be added without adding a reference for the project. /// - Task AddMissingImportsAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, IProgress progressTracker, CancellationToken cancellationToken); + Task AddMissingImportsAsync(Document document, TextSpan textSpan, IProgress progressTracker, CancellationToken cancellationToken); /// /// Analyzes the document inside the texstpan to determine if imports can be added. /// - Task AnalyzeAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken); + Task AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); /// - /// Performs the same action as but with a predetermined analysis of the input + /// Performs the same action as but with a predetermined analysis of the input /// instead of recalculating it /// - Task AddMissingImportsAsync(Document document, AddMissingImportsAnalysisResult analysisResult, SyntaxFormattingOptions formattingOptions, IProgress progressTracker, CancellationToken cancellationToken); + Task AddMissingImportsAsync(Document document, AddMissingImportsAnalysisResult analysisResult, IProgress progressTracker, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/Completion/CompletionOptions.cs b/src/Features/Core/Portable/Completion/CompletionOptions.cs index af74d8c8020b1..e625ab9819d59 100644 --- a/src/Features/Core/Portable/Completion/CompletionOptions.cs +++ b/src/Features/Core/Portable/Completion/CompletionOptions.cs @@ -18,7 +18,7 @@ internal sealed record class CompletionOptions public bool TriggerInArgumentLists { get; init; } = true; public EnterKeyRule EnterKeyBehavior { get; init; } = EnterKeyRule.Default; public SnippetsRule SnippetsBehavior { get; init; } = SnippetsRule.Default; - public bool HideAdvancedMembers { get; init; } = MemberDisplayOptionsStorage.HideAdvancedMembers.DefaultValue; + public MemberDisplayOptions MemberDisplayOptions { get; init; } = MemberDisplayOptions.Default; public bool ShowNameSuggestions { get; init; } = true; public bool? ShowItemsFromUnimportedNamespaces { get; init; } = true; public bool UnnamedSymbolCompletionDisabled { get; init; } = false; @@ -59,7 +59,7 @@ public RecommendationServiceOptions ToRecommendationServiceOptions() => new() { FilterOutOfScopeLocals = FilterOutOfScopeLocals, - HideAdvancedMembers = HideAdvancedMembers + HideAdvancedMembers = MemberDisplayOptions.HideAdvancedMembers }; /// diff --git a/src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.cs b/src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.cs index 3049432c098d4..55db699a45d8a 100644 --- a/src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.cs +++ b/src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Completion.Providers; @@ -23,7 +24,10 @@ internal override async Task GetDescriptionWorkerAsync( if (item.TryGetProperty(HideAdvancedMembers, out var hideAdvancedMembersString) && bool.TryParse(hideAdvancedMembersString, out var hideAdvancedMembers)) { - options = options with { HideAdvancedMembers = hideAdvancedMembers }; + options = options with + { + MemberDisplayOptions = new() { HideAdvancedMembers = hideAdvancedMembers } + }; } var (token, semanticModel, symbols) = await GetSymbolsAsync(document, position, options, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/Completion/Providers/AbstractObjectCreationCompletionProvider.cs b/src/Features/Core/Portable/Completion/Providers/AbstractObjectCreationCompletionProvider.cs index 8e10ec8999830..94e1170f2e2f9 100644 --- a/src/Features/Core/Portable/Completion/Providers/AbstractObjectCreationCompletionProvider.cs +++ b/src/Features/Core/Portable/Completion/Providers/AbstractObjectCreationCompletionProvider.cs @@ -92,7 +92,7 @@ protected override Task> GetSymbolsAsync( return SpecializedTasks.EmptyImmutableArray(); } - if (!type.IsEditorBrowsable(options.HideAdvancedMembers, context.SemanticModel.Compilation)) + if (!type.IsEditorBrowsable(options.MemberDisplayOptions.HideAdvancedMembers, context.SemanticModel.Compilation)) return SpecializedTasks.EmptyImmutableArray(); // In the case of array creation, we don't offer a preselected/hard-selected item because diff --git a/src/Features/Core/Portable/Completion/Providers/AbstractObjectInitializerCompletionProvider.cs b/src/Features/Core/Portable/Completion/Providers/AbstractObjectInitializerCompletionProvider.cs index e772caac1da80..71cb924868a2f 100644 --- a/src/Features/Core/Portable/Completion/Providers/AbstractObjectInitializerCompletionProvider.cs +++ b/src/Features/Core/Portable/Completion/Providers/AbstractObjectInitializerCompletionProvider.cs @@ -63,7 +63,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context) var uninitializedMembers = members.Where(m => !alreadyTypedMembers.Contains(m.Name)); // Sort the members by name so if we preselect one, it'll be stable - uninitializedMembers = uninitializedMembers.Where(m => m.IsEditorBrowsable(context.CompletionOptions.HideAdvancedMembers, semanticModel.Compilation)) + uninitializedMembers = uninitializedMembers.Where(m => m.IsEditorBrowsable(context.CompletionOptions.MemberDisplayOptions.HideAdvancedMembers, semanticModel.Compilation)) .OrderBy(m => m.Name); var firstUnitializedRequiredMember = true; diff --git a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractExtensionMethodImportCompletionProvider.cs b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractExtensionMethodImportCompletionProvider.cs index 73e2dd53e0978..adde10f5e2e95 100644 --- a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractExtensionMethodImportCompletionProvider.cs +++ b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractExtensionMethodImportCompletionProvider.cs @@ -54,7 +54,7 @@ protected override async Task AddCompletionItemsAsync( namespaceInScope, inferredTypes, forceCacheCreation: completionContext.CompletionOptions.ForceExpandedCompletionIndexCreation, - hideAdvancedMembers: completionContext.CompletionOptions.HideAdvancedMembers, + hideAdvancedMembers: completionContext.CompletionOptions.MemberDisplayOptions.HideAdvancedMembers, cancellationToken).ConfigureAwait(false); if (result is not null) diff --git a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs index 6067e48e693ae..fd57802c597cc 100644 --- a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs +++ b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs @@ -61,7 +61,7 @@ ImmutableArray GetItemsFromCacheResult(TypeImportCompletionCache syntaxContext.IsAttributeNameContext, syntaxContext.IsEnumBaseListContext, IsCaseSensitive, - options.HideAdvancedMembers); + options.MemberDisplayOptions.HideAdvancedMembers); } private async Task<(ImmutableArray results, bool isPartial)> GetCacheEntriesAsync(Project currentProject, Compilation originCompilation, bool forceCacheCreation, CancellationToken cancellationToken) diff --git a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs index 0bec88dc4b450..a1920c9d3aa03 100644 --- a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs +++ b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.SignatureHelp; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; @@ -14,7 +15,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; /// internal abstract class VSTypeScriptSignatureHelpProviderBase : ISignatureHelpProvider { - Task ISignatureHelpProvider.GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + Task ISignatureHelpProvider.GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) => GetItemsAsync(document, position, triggerInfo, cancellationToken); public abstract bool IsTriggerCharacter(char ch); diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 2225e8f58b5b9..f892d1bed8689 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -3264,4 +3264,10 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Unable to load type '{0}': '{1}' + + Type members + + + .NET Code Actions + \ No newline at end of file diff --git a/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyCodeFixProvider.cs b/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyCodeFixProvider.cs index 349df5dff0609..43ec1dc6c3a75 100644 --- a/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyCodeFixProvider.cs +++ b/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyCodeFixProvider.cs @@ -22,10 +22,9 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var cancellationToken = context.CancellationToken; var document = context.Document; - var hideAdvancedMembers = context.Options.GetOptions(document.Project.Services).HideAdvancedMembers; var service = document.GetRequiredLanguageService(); - var optFixData = await service.GetFixDataAsync(document, context.Span, hideAdvancedMembers, cancellationToken).ConfigureAwait(false); + var optFixData = await service.GetFixDataAsync(document, context.Span, cancellationToken).ConfigureAwait(false); if (optFixData is null) return; diff --git a/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs b/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs index 42aaba3e17894..226d4274bac46 100644 --- a/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs +++ b/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -37,14 +38,14 @@ internal abstract partial class AbstractFullyQualifyService : protected abstract Task ReplaceNodeAsync(TSimpleNameSyntax simpleName, string containerName, bool resultingSymbolIsType, CancellationToken cancellationToken); public async Task GetFixDataAsync( - Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken) + Document document, TextSpan span, CancellationToken cancellationToken) { var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryInvokeAsync( document.Project, - (service, solutionChecksum, cancellationToken) => service.GetFixDataAsync(solutionChecksum, document.Id, span, hideAdvancedMembers, cancellationToken), + (service, solutionChecksum, cancellationToken) => service.GetFixDataAsync(solutionChecksum, document.Id, span, cancellationToken), cancellationToken).ConfigureAwait(false); if (!result.HasValue) @@ -53,11 +54,11 @@ internal abstract partial class AbstractFullyQualifyService : return result.Value; } - return await GetFixDataInCurrentProcessAsync(document, span, hideAdvancedMembers, cancellationToken).ConfigureAwait(false); + return await GetFixDataInCurrentProcessAsync(document, span, cancellationToken).ConfigureAwait(false); } private async Task GetFixDataInCurrentProcessAsync( - Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken) + Document document, TextSpan span, CancellationToken cancellationToken) { var project = document.Project; var syntaxFacts = document.GetRequiredLanguageService(); @@ -84,8 +85,9 @@ internal abstract partial class AbstractFullyQualifyService : // We found some matches for the name alone. Do some more checks to see if those matches are applicable in this location. var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var options = await document.GetMemberDisplayOptionsAsync(cancellationToken).ConfigureAwait(false); - var matchingTypeSearchResults = GetTypeSearchResults(semanticModel, simpleName, hideAdvancedMembers, matchingTypes.Concat(matchingAttributeTypes)); + var matchingTypeSearchResults = GetTypeSearchResults(semanticModel, simpleName, options.HideAdvancedMembers, matchingTypes.Concat(matchingAttributeTypes)); var matchingNamespaceSearchResults = GetNamespaceSearchResults(semanticModel, simpleName, matchingNamespaces); if (matchingTypeSearchResults.IsEmpty && matchingNamespaceSearchResults.IsEmpty) return null; diff --git a/src/Features/Core/Portable/FullyQualify/IFullyQualifyService.cs b/src/Features/Core/Portable/FullyQualify/IFullyQualifyService.cs index 1c7b2e3fa7061..958505dffbbac 100644 --- a/src/Features/Core/Portable/FullyQualify/IFullyQualifyService.cs +++ b/src/Features/Core/Portable/FullyQualify/IFullyQualifyService.cs @@ -32,5 +32,5 @@ internal readonly struct FullyQualifyIndividualFixData(string title, ImmutableAr internal interface IFullyQualifyService : ILanguageService { - Task GetFixDataAsync(Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken); + Task GetFixDataAsync(Document document, TextSpan span, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/FullyQualify/IRemoteFullyQualifyService.cs b/src/Features/Core/Portable/FullyQualify/IRemoteFullyQualifyService.cs index d59e2c7bb2cc9..8b44e31015855 100644 --- a/src/Features/Core/Portable/FullyQualify/IRemoteFullyQualifyService.cs +++ b/src/Features/Core/Portable/FullyQualify/IRemoteFullyQualifyService.cs @@ -10,5 +10,5 @@ namespace Microsoft.CodeAnalysis.CodeFixes.FullyQualify; internal interface IRemoteFullyQualifyService { - ValueTask GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken); + ValueTask GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/Options/EditorConfig/EditorConfigOptionsEnumerator.cs b/src/Features/Core/Portable/Options/EditorConfig/EditorConfigOptionsEnumerator.cs index 43b0702f275cd..f560d9a2097e9 100644 --- a/src/Features/Core/Portable/Options/EditorConfig/EditorConfigOptionsEnumerator.cs +++ b/src/Features/Core/Portable/Options/EditorConfig/EditorConfigOptionsEnumerator.cs @@ -32,11 +32,7 @@ internal sealed class EditorConfigOptionsEnumerator( internal static IEnumerable<(string feature, ImmutableArray options)> GetLanguageAgnosticEditorConfigOptions(bool includeUnsupported) { - yield return (WorkspacesResources.Core_EditorConfig_Options, - [ - .. FormattingOptions2.EditorConfigOptions, - .. MemberDisplayOptionsStorage.EditorConfigOptions - ]); + yield return (WorkspacesResources.Core_EditorConfig_Options, FormattingOptions2.EditorConfigOptions); if (includeUnsupported) { @@ -47,6 +43,8 @@ .. MemberDisplayOptionsStorage.EditorConfigOptions yield return ("unsupported", RegexOptionsStorage.UnsupportedOptions); } + yield return (FeaturesResources.NET_Code_Actions, MemberDisplayOptionsStorage.EditorConfigOptions); + yield return (WorkspacesResources.dot_NET_Coding_Conventions, [ .. GenerationOptions.EditorConfigOptions, diff --git a/src/Features/Core/Portable/Options/MemberDisplayOptions.cs b/src/Features/Core/Portable/Options/MemberDisplayOptions.cs new file mode 100644 index 0000000000000..fcdfb9064660a --- /dev/null +++ b/src/Features/Core/Portable/Options/MemberDisplayOptions.cs @@ -0,0 +1,55 @@ +// 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.Collections.Immutable; +using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Options; + +namespace Microsoft.CodeAnalysis; + +[DataContract] +internal readonly record struct MemberDisplayOptions() +{ + public static readonly MemberDisplayOptions Default = new(); + + [DataMember] + public bool HideAdvancedMembers { get; init; } = false; +} + +/// +/// Options customizing member display. Used by multiple features. +/// +internal static class MemberDisplayOptionsStorage +{ + public static readonly OptionGroup CodeActionsGroup = new(name: "code_actions", description: FeaturesResources.NET_Code_Actions, priority: 3); + public static readonly OptionGroup TypeMemberGroup = new(name: "type_members", description: FeaturesResources.Type_members, priority: 3, parent: CodeActionsGroup); + + public static readonly PerLanguageOption2 HideAdvancedMembers = new( + "dotnet_hide_advanced_members", + MemberDisplayOptions.Default.HideAdvancedMembers, + isEditorConfigOption: true, + group: TypeMemberGroup); + + /// + /// Options that we expect the user to set in editorconfig. + /// + public static readonly ImmutableArray EditorConfigOptions = [HideAdvancedMembers]; +} + +internal static class MemberDisplayOptionsProviders +{ + public static MemberDisplayOptions GetMemberDisplayOptions(this IOptionsReader reader, string language) + => new() + { + HideAdvancedMembers = reader.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, language) + }; + + public static async ValueTask GetMemberDisplayOptionsAsync(this Document document, CancellationToken cancellationToken) + { + var configOptions = await document.GetAnalyzerConfigOptionsAsync(cancellationToken).ConfigureAwait(false); + return configOptions.GetMemberDisplayOptions(document.Project.Language); + } +} diff --git a/src/Features/Core/Portable/Options/MemberDisplayOptionsStorage.cs b/src/Features/Core/Portable/Options/MemberDisplayOptionsStorage.cs deleted file mode 100644 index d8ff807a6e76f..0000000000000 --- a/src/Features/Core/Portable/Options/MemberDisplayOptionsStorage.cs +++ /dev/null @@ -1,26 +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.Collections.Immutable; - -namespace Microsoft.CodeAnalysis.Options; - -/// -/// Options customizing member display. Used by multiple features. -/// -internal static class MemberDisplayOptionsStorage -{ - public static readonly OptionGroup Group = new(name: "member_display", description: ""); - - public static readonly PerLanguageOption2 HideAdvancedMembers = new( - "dotnet_hide_advanced_members", - defaultValue: false, - isEditorConfigOption: true, - group: Group); - - /// - /// Options that we expect the user to set in editorconfig. - /// - public static readonly ImmutableArray EditorConfigOptions = [HideAdvancedMembers]; -} diff --git a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs index a2c755e5f1f09..08201357066f1 100644 --- a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs +++ b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; @@ -34,7 +35,7 @@ protected AbstractSignatureHelpProvider() public abstract bool IsTriggerCharacter(char ch); public abstract bool IsRetriggerCharacter(char ch); - protected abstract Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken); + protected abstract Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken); protected static SignatureHelpItems? CreateSignatureHelpItems( IList items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) @@ -240,7 +241,7 @@ private static SignatureHelpSymbolParameter ReplaceStructuralTypes( } public async Task GetItemsAsync( - Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var itemsForCurrentDocument = await GetItemsWorkerAsync(document, position, triggerInfo, options, cancellationToken).ConfigureAwait(false); if (itemsForCurrentDocument == null) diff --git a/src/Features/Core/Portable/SignatureHelp/CommonSignatureHelpUtilities.cs b/src/Features/Core/Portable/SignatureHelp/CommonSignatureHelpUtilities.cs index 09d98570d44c9..8b082935ac5eb 100644 --- a/src/Features/Core/Portable/SignatureHelp/CommonSignatureHelpUtilities.cs +++ b/src/Features/Core/Portable/SignatureHelp/CommonSignatureHelpUtilities.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Operations; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -145,7 +146,7 @@ internal static bool TryGetSyntax( } public static async Task> GetCollectionInitializerAddMethodsAsync( - Document document, SyntaxNode initializer, SignatureHelpOptions options, CancellationToken cancellationToken) + Document document, SyntaxNode initializer, MemberDisplayOptions options, CancellationToken cancellationToken) { if (initializer is not { Parent: not null }) return default; diff --git a/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs b/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs index 91405b853f8ea..08a064c9cf35c 100644 --- a/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs +++ b/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.SignatureHelp; @@ -24,5 +25,5 @@ internal interface ISignatureHelpProvider /// /// Returns valid signature help items at the specified position in the document. /// - Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken); + Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/SignatureHelp/SignatureHelpOptions.cs b/src/Features/Core/Portable/SignatureHelp/SignatureHelpOptions.cs deleted file mode 100644 index 603dde07da85f..0000000000000 --- a/src/Features/Core/Portable/SignatureHelp/SignatureHelpOptions.cs +++ /dev/null @@ -1,20 +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 Microsoft.CodeAnalysis.Completion; -using System.Runtime.Serialization; - -namespace Microsoft.CodeAnalysis.SignatureHelp; - -[DataContract] -internal readonly record struct SignatureHelpOptions -{ - [DataMember] public bool HideAdvancedMembers { get; init; } = CompletionOptions.Default.HideAdvancedMembers; - - public SignatureHelpOptions() - { - } - - public static readonly SignatureHelpOptions Default = new(); -} diff --git a/src/Features/Core/Portable/SignatureHelp/SignatureHelpService.cs b/src/Features/Core/Portable/SignatureHelp/SignatureHelpService.cs index 186fd418b8d7d..d010ec59aaf46 100644 --- a/src/Features/Core/Portable/SignatureHelp/SignatureHelpService.cs +++ b/src/Features/Core/Portable/SignatureHelp/SignatureHelpService.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.SignatureHelp; @@ -43,7 +44,6 @@ private ImmutableArray GetProviders(string language) Document document, int position, SignatureHelpTriggerInfo triggerInfo, - SignatureHelpOptions options, CancellationToken cancellationToken) { return GetSignatureHelpAsync( @@ -51,7 +51,6 @@ private ImmutableArray GetProviders(string language) document, position, triggerInfo, - options, cancellationToken); } @@ -64,11 +63,12 @@ private ImmutableArray GetProviders(string language) Document document, int position, SignatureHelpTriggerInfo triggerInfo, - SignatureHelpOptions options, CancellationToken cancellationToken) { var extensionManager = document.Project.Solution.Services.GetRequiredService(); + var options = await document.GetMemberDisplayOptionsAsync(cancellationToken).ConfigureAwait(false); + ISignatureHelpProvider? bestProvider = null; SignatureHelpItems? bestItems = null; diff --git a/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs b/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs index 890b1997b3ff7..d0cb05ab2e550 100644 --- a/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs +++ b/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckCodeFixProvider.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; @@ -110,13 +111,15 @@ private async Task CreateSpellCheckCodeIssueAsync( var document = context.Document; var service = CompletionService.GetService(document); + var memberDisplayOptions = await document.GetMemberDisplayOptionsAsync(cancellationToken).ConfigureAwait(false); + // Disable snippets and unimported types from ever appearing in the completion items. // - It's very unlikely the user would ever misspell a snippet, then use spell-checking to fix it, // then try to invoke the snippet. // - We believe spell-check should only compare what you have typed to what symbol would be offered here. var options = CompletionOptions.Default with { - HideAdvancedMembers = context.Options.GetOptions(document.Project.Services).HideAdvancedMembers, + MemberDisplayOptions = memberDisplayOptions, SnippetsBehavior = SnippetsRule.NeverInclude, ShowItemsFromUnimportedNamespaces = false, TargetTypedCompletionFilter = false, diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index d1dd9117f4fdb..80b2136a163bb 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -1285,6 +1285,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přesunutí {0} vyžaduje restartování aplikace. + + .NET Code Actions + .NET Code Actions + + Name expected Očekával se název @@ -2805,6 +2810,11 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Čárka na konci není povolená + + Type members + Type members + + Types: Typy: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index ae43eeeb61bf2..3e9ed612bd629 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -1285,6 +1285,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Verschieben von {0} erfordert einen Neustart der Anwendung. + + .NET Code Actions + .NET Code Actions + + Name expected Name erwartet @@ -2805,6 +2810,11 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Ein nachgestelltes Komma ist unzulässig + + Type members + Type members + + Types: Typen: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 0ed0e971b3fa7..076317affdb1a 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -1285,6 +1285,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para mover {0} es necesario reiniciar la aplicación. + + .NET Code Actions + .NET Code Actions + + Name expected Nombre esperado @@ -2805,6 +2810,11 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Coma final no permitida + + Type members + Type members + + Types: Tipos: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 29791cb61ad27..63d7c23de2a9d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -1285,6 +1285,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Le déplacement de {0} requiert le redémarrage de l’application. + + .NET Code Actions + .NET Code Actions + + Name expected Nom attendu @@ -2805,6 +2810,11 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Virgule de fin non autorisée + + Type members + Type members + + Types: Types : diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 12504374d3b9f..99110700674ac 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -1285,6 +1285,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si sposta {0}, è necessario riavviare l'applicazione. + + .NET Code Actions + .NET Code Actions + + Name expected Previsto nome @@ -2805,6 +2810,11 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Virgola finale non consentita + + Type members + Type members + + Types: Tipi: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index b02b127f7230c..be4d32f6ba45f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -1285,6 +1285,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} を移動するには、アプリケーションを再起動する必要があります。 + + .NET Code Actions + .NET Code Actions + + Name expected 名前が必要です @@ -2805,6 +2810,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 末尾にコンマは使用できない + + Type members + Type members + + Types: 型: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 375e1a3170577..5dc90d79ad7b2 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -1285,6 +1285,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0}을(를) 이동하려면 애플리케이션을 다시 시작해야 합니다. + + .NET Code Actions + .NET Code Actions + + Name expected 이름이 필요합니다. @@ -2805,6 +2810,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 후행 쉼표는 허용되지 않습니다. + + Type members + Type members + + Types: 형식: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index a99ed62dcc5e4..8eab32df69692 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -1285,6 +1285,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Przeniesienie elementu {0} wymaga ponownego uruchomienia aplikacji. + + .NET Code Actions + .NET Code Actions + + Name expected Oczekiwano nazwy @@ -2805,6 +2810,11 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Końcowy przecinek jest niedozwolony. + + Type members + Type members + + Types: Typy: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index fd3416c98c554..4c59a203b786e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -1285,6 +1285,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Mover {0} requer reiniciar o aplicativo. + + .NET Code Actions + .NET Code Actions + + Name expected Nome esperado @@ -2805,6 +2810,11 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Vírgula à direita não permitida + + Type members + Type members + + Types: Tipos: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 942d79ac52ba1..e18ca3476aca1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -1285,6 +1285,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для перемещения {0} требуется перезапустить приложение. + + .NET Code Actions + .NET Code Actions + + Name expected Ожидалось имя @@ -2805,6 +2810,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Завершающая запятая не разрешена + + Type members + Type members + + Types: Типы: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 78309d2ab557a..2d2ed5ed366e8 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -1285,6 +1285,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin taşınması uygulamanın yeniden başlatılmasını gerektirir. + + .NET Code Actions + .NET Code Actions + + Name expected Ad bekleniyor @@ -2805,6 +2810,11 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Sona eklenen virgüle izin verilmiyor + + Type members + Type members + + Types: Türler: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index fa553c0757b3f..c03a012df542b 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -1285,6 +1285,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移动 {0} 要求重启应用程序。 + + .NET Code Actions + .NET Code Actions + + Name expected 预期名称 @@ -2805,6 +2810,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 不允许使用尾随逗号 + + Type members + Type members + + Types: 类型: diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index bbef227385bf5..9dec3caef3487 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -1285,6 +1285,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 移動 {0} 需要重新啟動應用程式。 + + .NET Code Actions + .NET Code Actions + + Name expected 預期的名稱 @@ -2805,6 +2810,11 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 尾端不得為逗號 + + Type members + Type members + + Types: 類型: diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CompletionListTagCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CompletionListTagCompletionProvider.vb index ae45ea26debda..0ac67c3d17083 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CompletionListTagCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CompletionListTagCompletionProvider.vb @@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers If member.MatchesKind(SymbolKind.Field, SymbolKind.Property) AndAlso member.IsStatic AndAlso member.IsAccessibleWithin(within) AndAlso - member.IsEditorBrowsable(options.HideAdvancedMembers, syntaxContext.SemanticModel.Compilation) Then + member.IsEditorBrowsable(options.MemberDisplayOptions.HideAdvancedMembers, syntaxContext.SemanticModel.Compilation) Then builder.Add(New SymbolAndSelectionInfo(member, Preselect:=True)) End If Next diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb index ba7d41ad967fc..ba05e293c4fb3 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb @@ -65,7 +65,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers builder.Add(New SymbolAndSelectionInfo(enumType, Preselect:=False)) For Each member In enumType.GetMembers() - If member.Kind = SymbolKind.Field AndAlso DirectCast(member, IFieldSymbol).IsConst AndAlso member.IsEditorBrowsable(options.HideAdvancedMembers, syntaxContext.SemanticModel.Compilation) Then + If member.Kind = SymbolKind.Field AndAlso DirectCast(member, IFieldSymbol).IsConst AndAlso member.IsEditorBrowsable(options.MemberDisplayOptions.HideAdvancedMembers, syntaxContext.SemanticModel.Compilation) Then builder.Add(New SymbolAndSelectionInfo(member, Preselect:=True)) End If Next diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb index 212550ea17e8d..bc6d68bd38726 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb @@ -28,7 +28,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp node) End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim node As TSyntaxNode = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb index ea475fbca2b7e..642dea7974879 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb @@ -51,7 +51,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token <> node.ArgumentList.CloseParenToken End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim attribute As AttributeSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb index a16d151b5cd09..45155e10750ae 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb @@ -45,7 +45,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Return expression.Span.Contains(token.SpanStart) AndAlso token <> expression.CloseBraceToken End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim collectionInitializer As CollectionInitializerSyntax = Nothing If Not TryGetInitializerExpression(root, position, document.GetLanguageService(Of ISyntaxFactsService)(), triggerInfo.TriggerReason, cancellationToken, collectionInitializer) Then diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb index f684310e77f16..c60af0d3f5461 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb @@ -53,7 +53,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp functionAggregation) End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim functionAggregation As FunctionAggregationSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb index d8d0bdce26d89..2a73b96530b4f 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb @@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token <> node.TypeArgumentList.CloseParenToken End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim genericName As GenericNameSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb index 2016b9b843f76..b183b08aef08b 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb @@ -62,7 +62,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token <> node.ArgumentList.CloseParenToken End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim invocationExpression As InvocationExpressionSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb index d31c052858f00..f2b58e7f0026d 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb @@ -20,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp structuralTypeDisplayService As IStructuralTypeDisplayService, normalType As INamedTypeSymbol, within As ISymbol, - options As SignatureHelpOptions, cancellationToken As CancellationToken) As (items As IList(Of SignatureHelpItem), selectedItem As Integer?) + options As MemberDisplayOptions, cancellationToken As CancellationToken) As (items As IList(Of SignatureHelpItem), selectedItem As Integer?) Dim accessibleConstructors = normalType.InstanceConstructors. WhereAsArray(Function(c) c.IsAccessibleWithin(within)). diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb index dba03323a1d7b..c5b9e39ccb43d 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb @@ -61,7 +61,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token <> node.ArgumentList.CloseParenToken End Function - Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As SignatureHelpOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) + Protected Overrides Async Function GetItemsWorkerAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, options As MemberDisplayOptions, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim objectCreationExpression As ObjectCreationExpressionSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb index 7ea7193e7cd8e..12e902814ac5e 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb @@ -64,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, - options As SignatureHelpOptions, + options As MemberDisplayOptions, cancellationToken As CancellationToken ) As Task(Of SignatureHelpItems) diff --git a/src/LanguageServer/Protocol/Features/Options/CodeActionOptionsStorage.cs b/src/LanguageServer/Protocol/Features/Options/CodeActionOptionsStorage.cs index e17682e5ac7f2..50a628cadaad7 100644 --- a/src/LanguageServer/Protocol/Features/Options/CodeActionOptionsStorage.cs +++ b/src/LanguageServer/Protocol/Features/Options/CodeActionOptionsStorage.cs @@ -21,7 +21,6 @@ public static CodeActionOptions GetCodeActionOptions(this IGlobalOptionService g CodeGenerationOptions = globalOptions.GetCodeGenerationOptions(languageServices), SearchOptions = globalOptions.GetSymbolSearchOptions(languageServices.Language), ImplementTypeOptions = globalOptions.GetImplementTypeOptions(languageServices.Language), - HideAdvancedMembers = globalOptions.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, languageServices.Language), }; internal static CodeActionOptionsProvider GetCodeActionOptionsProvider(this IGlobalOptionService globalOptions) diff --git a/src/LanguageServer/Protocol/Features/Options/CompletionOptionsStorage.cs b/src/LanguageServer/Protocol/Features/Options/CompletionOptionsStorage.cs index a089489f1e1df..2b237f5da50c6 100644 --- a/src/LanguageServer/Protocol/Features/Options/CompletionOptionsStorage.cs +++ b/src/LanguageServer/Protocol/Features/Options/CompletionOptionsStorage.cs @@ -26,7 +26,7 @@ public static CompletionOptions GetCompletionOptions(this IGlobalOptionService o TriggerInArgumentLists = options.GetOption(TriggerInArgumentLists, language), EnterKeyBehavior = options.GetOption(EnterKeyBehavior, language), SnippetsBehavior = options.GetOption(SnippetsBehavior, language), - HideAdvancedMembers = options.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, language), + MemberDisplayOptions = options.GetMemberDisplayOptions(language), ShowNameSuggestions = options.GetOption(ShowNameSuggestions, language), ShowItemsFromUnimportedNamespaces = options.GetOption(ShowItemsFromUnimportedNamespaces, language), UnnamedSymbolCompletionDisabled = options.GetOption(UnnamedSymbolCompletionDisabledFeatureFlag), diff --git a/src/LanguageServer/Protocol/Features/Options/SignatureHelpOptionsStorage.cs b/src/LanguageServer/Protocol/Features/Options/SignatureHelpOptionsStorage.cs deleted file mode 100644 index a49627a256b46..0000000000000 --- a/src/LanguageServer/Protocol/Features/Options/SignatureHelpOptionsStorage.cs +++ /dev/null @@ -1,16 +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 Microsoft.CodeAnalysis.Options; - -namespace Microsoft.CodeAnalysis.SignatureHelp; - -internal static class SignatureHelpOptionsStorage -{ - public static SignatureHelpOptions GetSignatureHelpOptions(this IGlobalOptionService globalOptions, string language) - => new() - { - HideAdvancedMembers = globalOptions.GetOption(MemberDisplayOptionsStorage.HideAdvancedMembers, language) - }; -} diff --git a/src/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs b/src/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs index e62b802c64d61..a9a782fe910a7 100644 --- a/src/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs +++ b/src/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs @@ -21,21 +21,10 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler { [ExportCSharpVisualBasicStatelessLspService(typeof(SignatureHelpHandler)), Shared] [Method(LSP.Methods.TextDocumentSignatureHelpName)] - internal class SignatureHelpHandler : ILspServiceDocumentRequestHandler + [method: ImportingConstructor] + [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + internal class SignatureHelpHandler(SignatureHelpService signatureHelpService) : ILspServiceDocumentRequestHandler { - private readonly SignatureHelpService _signatureHelpService; - private readonly IGlobalOptionService _globalOptions; - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public SignatureHelpHandler( - SignatureHelpService signatureHelpService, - IGlobalOptionService globalOptions) - { - _signatureHelpService = signatureHelpService; - _globalOptions = globalOptions; - } - public bool MutatesSolutionState => false; public bool RequiresLSPSolution => true; @@ -49,16 +38,15 @@ public SignatureHelpHandler( var supportsVisualStudioExtensions = context.GetRequiredClientCapabilities().HasVisualStudioLspCapability(); var linePosition = ProtocolConversions.PositionToLinePosition(request.Position); - return GetSignatureHelpAsync(_globalOptions, _signatureHelpService, document, linePosition, supportsVisualStudioExtensions, cancellationToken); + return GetSignatureHelpAsync(signatureHelpService, document, linePosition, supportsVisualStudioExtensions, cancellationToken); } - internal static async Task GetSignatureHelpAsync(IGlobalOptionService globalOptions, SignatureHelpService signatureHelpService, Document document, LinePosition linePosition, bool supportsVisualStudioExtensions, CancellationToken cancellationToken) + internal static async Task GetSignatureHelpAsync(SignatureHelpService signatureHelpService, Document document, LinePosition linePosition, bool supportsVisualStudioExtensions, CancellationToken cancellationToken) { var position = await document.GetPositionFromLinePositionAsync(linePosition, cancellationToken).ConfigureAwait(false); var triggerInfo = new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand); - var options = globalOptions.GetSignatureHelpOptions(document.Project.Language); - var (_, sigItems) = await signatureHelpService.GetSignatureHelpAsync(document, position, triggerInfo, options, cancellationToken).ConfigureAwait(false); + var (_, sigItems) = await signatureHelpService.GetSignatureHelpAsync(document, position, triggerInfo, cancellationToken).ConfigureAwait(false); if (sigItems is null) { return null; diff --git a/src/Tools/ExternalAccess/Razor/Cohost/Handlers/SignatureHelp.cs b/src/Tools/ExternalAccess/Razor/Cohost/Handlers/SignatureHelp.cs index 05fda525f2c05..bcc8cfb0b9a52 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/Handlers/SignatureHelp.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/Handlers/SignatureHelp.cs @@ -16,9 +16,8 @@ internal static class SignatureHelp { public static Task GetSignatureHelpAsync(Document document, LinePosition linePosition, bool supportsVisualStudioExtensions, CancellationToken cancellationToken) { - var globalOptions = document.Project.Solution.Services.ExportProvider.GetService(); var signatureHelpService = document.Project.Solution.Services.ExportProvider.GetService(); - return SignatureHelpHandler.GetSignatureHelpAsync(globalOptions, signatureHelpService, document, linePosition, supportsVisualStudioExtensions, cancellationToken); + return SignatureHelpHandler.GetSignatureHelpAsync(signatureHelpService, document, linePosition, supportsVisualStudioExtensions, cancellationToken); } } diff --git a/src/VisualStudio/Core/Test/Options/BasicEditorConfigGeneratorTests.vb b/src/VisualStudio/Core/Test/Options/BasicEditorConfigGeneratorTests.vb index 34b66f3841a46..9239f35bce3d3 100644 --- a/src/VisualStudio/Core/Test/Options/BasicEditorConfigGeneratorTests.vb +++ b/src/VisualStudio/Core/Test/Options/BasicEditorConfigGeneratorTests.vb @@ -36,6 +36,11 @@ tab_width = 4 end_of_line = crlf insert_final_newline = false +#### .NET Code Actions #### + +# Type members +dotnet_hide_advanced_members = false + #### .NET Coding Conventions #### # Organize usings @@ -179,6 +184,11 @@ tab_width = 4 end_of_line = crlf insert_final_newline = false +#### .NET Code Actions #### + +# Type members +dotnet_hide_advanced_members = false + #### .NET Coding Conventions #### # Organize usings diff --git a/src/VisualStudio/Core/Test/Options/CSharpEditorConfigGeneratorTests.vb b/src/VisualStudio/Core/Test/Options/CSharpEditorConfigGeneratorTests.vb index 099a79ce8709e..4ffd7d0f8026c 100644 --- a/src/VisualStudio/Core/Test/Options/CSharpEditorConfigGeneratorTests.vb +++ b/src/VisualStudio/Core/Test/Options/CSharpEditorConfigGeneratorTests.vb @@ -34,6 +34,11 @@ tab_width = 4 end_of_line = crlf insert_final_newline = false +#### .NET Code Actions #### + +# Type members +dotnet_hide_advanced_members = false + #### .NET Coding Conventions #### # Organize usings @@ -283,6 +288,11 @@ tab_width = 4 end_of_line = crlf insert_final_newline = false +#### .NET Code Actions #### + +# Type members +dotnet_hide_advanced_members = false + #### .NET Coding Conventions #### # Organize usings diff --git a/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs b/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs index 2efee1a907465..4d4650ce9ad4d 100644 --- a/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs +++ b/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs @@ -28,7 +28,7 @@ public FSharpSignatureHelpProvider(IFSharpSignatureHelpProvider provider) _provider = provider; } - public async Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, SignatureHelpOptions options, CancellationToken cancellationToken) + public async Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var mappedTriggerReason = FSharpSignatureHelpTriggerReasonHelpers.ConvertFrom(triggerInfo.TriggerReason); var mappedTriggerInfo = new FSharpSignatureHelpTriggerInfo(mappedTriggerReason, triggerInfo.TriggerCharacter); diff --git a/src/Workspaces/Remote/ServiceHub/Services/FullyQualify/RemoteFullyQualifyService.cs b/src/Workspaces/Remote/ServiceHub/Services/FullyQualify/RemoteFullyQualifyService.cs index 4d3a2eb49aa31..38dd4101afbf7 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/FullyQualify/RemoteFullyQualifyService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/FullyQualify/RemoteFullyQualifyService.cs @@ -25,7 +25,7 @@ public RemoteFullyQualifyService(in ServiceConstructionArguments arguments) { } - public ValueTask GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken) + public ValueTask GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, CancellationToken cancellationToken) { return RunServiceAsync(solutionChecksum, async solution => { @@ -33,7 +33,7 @@ public RemoteFullyQualifyService(in ServiceConstructionArguments arguments) var service = document.GetRequiredLanguageService(); - return await service.GetFixDataAsync(document, span, hideAdvancedMembers, cancellationToken).ConfigureAwait(false); + return await service.GetFixDataAsync(document, span, cancellationToken).ConfigureAwait(false); }, cancellationToken); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeActionOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeActionOptions.cs index bb531b3b84331..c591a899f7b83 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeActionOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeActionOptions.cs @@ -41,7 +41,6 @@ internal sealed record class CodeActionOptions [DataMember] public required CodeGenerationOptions CodeGenerationOptions { get; init; } [DataMember] public SymbolSearchOptions SearchOptions { get; init; } = SymbolSearchOptions.Default; [DataMember] public ImplementTypeOptions ImplementTypeOptions { get; init; } = ImplementTypeOptions.Default; - [DataMember] public bool HideAdvancedMembers { get; init; } = false; public static CodeActionOptions GetDefault(LanguageServices languageServices) => new()