Skip to content

Commit e51a3c6

Browse files
authored
Use ActivationConstraint.FeatureFlag API to control when Semantic Search is enabled (#77133)
1 parent 2de1096 commit e51a3c6

File tree

4 files changed

+1
-41
lines changed

4 files changed

+1
-41
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 & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,6 @@ async Task EnsureComponentModelAsync(PackageLoadTasks packageInitializationTasks
7070

7171
protected virtual void RegisterOnAfterPackageLoadedAsyncWork(PackageLoadTasks afterPackageLoadedTasks)
7272
{
73-
afterPackageLoadedTasks.AddTask(
74-
isMainThreadTask: false,
75-
task: (afterPackageLoadedTasks, cancellationToken) =>
76-
{
77-
// TODO: remove, workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1985204
78-
var globalOptions = ComponentModel.GetService<IGlobalOptionService>();
79-
if (globalOptions.GetOption(SemanticSearchFeatureFlag.Enabled))
80-
{
81-
afterPackageLoadedTasks.AddTask(
82-
isMainThreadTask: true,
83-
task: (packageLoadedTasks, cancellationToken) =>
84-
{
85-
UIContext.FromUIContextGuid(new Guid(SemanticSearchFeatureFlag.UIContextId)).IsActive = true;
86-
87-
return Task.CompletedTask;
88-
});
89-
}
90-
91-
return Task.CompletedTask;
92-
});
9373
}
9474

9575
protected async Task LoadComponentsInUIContextOnceSolutionFullyLoadedAsync(CancellationToken cancellationToken)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti
367367
{"dotnet_highlight_related_json_components", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.HighlightRelatedJsonComponentsUnderCursor")},
368368
{"dotnet_unsupported_report_invalid_json_patterns", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.ReportInvalidJsonPatterns")},
369369
{"visual_studio_enable_key_binding_reset", new FeatureFlagStorage("Roslyn.KeybindingResetEnabled")},
370-
{"visual_studio_enable_semantic_search", new FeatureFlagStorage("Roslyn.SemanticSearchEnabled")},
371370
{"visual_studio_enable_copilot_rename_context", new FeatureFlagStorage("Roslyn.CopilotRenameGetContext")},
372371
{"visual_studio_key_binding_needs_reset", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeedsReset")},
373372
{"visual_studio_key_binding_reset_never_show_again", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeverShowAgain")},

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

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

0 commit comments

Comments
 (0)