Skip to content

Commit 9ac65bb

Browse files
committed
Use ActivationConstraint.FeatureFlag API to control when Semantic Search is enabled
1 parent 85d110d commit 9ac65bb

File tree

4 files changed

+1
-35
lines changed

4 files changed

+1
-35
lines changed

src/VisualStudio/CSharp/Impl/SemanticSearch/OpenSemanticSearchWindowCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
65
using System.Threading;
76
using System.Threading.Tasks;
87
using Microsoft.VisualStudio.Extensibility;
@@ -20,7 +19,7 @@ internal sealed class OpenSemanticSearchWindowCommand : Command
2019
{
2120
Icon = new(ImageMoniker.KnownValues.FindSymbol, IconSettings.IconAndText),
2221
Placements = [CommandPlacement.KnownPlacements.ViewOtherWindowsMenu.WithPriority(0x8010)],
23-
VisibleWhen = ActivationConstraint.UIContext(Guid.Parse(SemanticSearchFeatureFlag.UIContextId))
22+
VisibleWhen = ActivationConstraint.FeatureFlag("Roslyn.SemanticSearchEnabled")
2423
};
2524

2625
public override Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)

src/VisualStudio/Core/Def/LanguageService/AbstractPackage.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
3535
Assumes.Present(_componentModel_doNotAccessDirectly);
3636
}
3737

38-
protected override async Task OnAfterPackageLoadedAsync(CancellationToken cancellationToken)
39-
{
40-
await base.OnAfterPackageLoadedAsync(cancellationToken).ConfigureAwait(false);
41-
42-
// TODO: remove, workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1985204
43-
var globalOptions = ComponentModel.GetService<IGlobalOptionService>();
44-
if (globalOptions.GetOption(SemanticSearchFeatureFlag.Enabled))
45-
{
46-
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
47-
UIContext.FromUIContextGuid(new Guid(SemanticSearchFeatureFlag.UIContextId)).IsActive = true;
48-
}
49-
}
50-
5138
protected async Task LoadComponentsInUIContextOnceSolutionFullyLoadedAsync(CancellationToken cancellationToken)
5239
{
5340
// UIContexts can be "zombied" if UIContexts aren't supported because we're in a command line build or in other scenarios.

src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti
371371
{"dotnet_highlight_related_json_components", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")},
372372
{"dotnet_unsupported_report_invalid_json_patterns", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")},
373373
{"visual_studio_enable_key_binding_reset", new FeatureFlagStorage("Roslyn.KeybindingResetEnabled")},
374-
{"visual_studio_enable_semantic_search", new FeatureFlagStorage("Roslyn.SemanticSearchEnabled")},
375374
{"visual_studio_enable_semantic_search_prompt", new FeatureFlagStorage("Roslyn.ShowPromptInSemanticSearch")},
376375
{"visual_studio_enable_copilot_rename_context", new FeatureFlagStorage("Roslyn.CopilotRenameGetContext")},
377376
{"visual_studio_key_binding_needs_reset", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeedsReset")},

src/VisualStudio/Core/Def/SemanticSearch/SemanticSearchFeatureFlag.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)