Skip to content

Commit 6f384ca

Browse files
authored
Make ISemanticSearchCopilotUIProvider import lazy to avoid loading VS.EA.Copilot (#77516)
1 parent a969b14 commit 6f384ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal sealed class SemanticSearchToolWindowImpl(
6464
IStreamingFindUsagesPresenter resultsPresenter,
6565
ITextUndoHistoryRegistry undoHistoryRegistry,
6666
ISemanticSearchCopilotService copilotService,
67-
ISemanticSearchCopilotUIProvider copilotUIProvider,
67+
Lazy<ISemanticSearchCopilotUIProvider> copilotUIProvider, // lazy to avoid loading Microsoft.VisualStudio.LanguageServices.ExternalAccess.Copilot
6868
IVsService<SVsUIShell, IVsUIShell> vsUIShellProvider) : ISemanticSearchWorkspaceHost, OptionsProvider<ClassificationOptions>
6969
{
7070
private const int ToolBarHeight = 26;
@@ -193,7 +193,7 @@ public async Task<FrameworkElement> InitializeAsync(CancellationToken cancellati
193193

194194
private CopilotUI? CreateCopilotUI()
195195
{
196-
if (!copilotUIProvider.IsAvailable || !copilotService.IsAvailable)
196+
if (!copilotUIProvider.Value.IsAvailable || !copilotService.IsAvailable)
197197
{
198198
return null;
199199
}
@@ -221,7 +221,7 @@ public async Task<FrameworkElement> InitializeAsync(CancellationToken cancellati
221221
promptGrid.ColumnDefinitions.Add(new ColumnDefinition { MaxWidth = 600, Width = GridLength.Auto });
222222
promptGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
223223

224-
var promptTextBox = copilotUIProvider.GetTextBox();
224+
var promptTextBox = copilotUIProvider.Value.GetTextBox();
225225

226226
var panel = new StackPanel()
227227
{

0 commit comments

Comments
 (0)