Skip to content

Commit 13c9d15

Browse files
committed
ensure that search sparkle appears when AI results available
1 parent 3a28ac2 commit 13c9d15

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/vs/workbench/contrib/search/browser/searchView.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export class SearchView extends ViewPane {
125125
private hasReplacePatternKey: IContextKey<boolean>;
126126
private hasFilePatternKey: IContextKey<boolean>;
127127
private hasSomeCollapsibleResultKey: IContextKey<boolean>;
128-
private hasAIResultProvider: IContextKey<boolean>;
129128

130129
private tree!: WorkbenchCompressibleObjectTree<RenderableMatch>;
131130
private treeLabels!: ResourceLabels;
@@ -221,10 +220,10 @@ export class SearchView extends ViewPane {
221220
this.hasSomeCollapsibleResultKey = Constants.SearchContext.ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService);
222221
this.treeViewKey = Constants.SearchContext.InTreeViewKey.bindTo(this.contextKeyService);
223222
this.aiResultsVisibleKey = Constants.SearchContext.AIResultsVisibleKey.bindTo(this.contextKeyService);
224-
this.hasAIResultProvider = Constants.SearchContext.hasAIResultProvider.bindTo(this.contextKeyService);
225223

226224
this._register(this.contextKeyService.onDidChangeContext(e => {
227-
if (e.affectsSome(new Set(Constants.SearchContext.hasAIResultProvider.keys()))) {
225+
const keys = Constants.SearchContext.hasAIResultProvider.keys();
226+
if (e.affectsSome(new Set(keys))) {
228227
this.refreshHasAISetting();
229228
}
230229
}));
@@ -436,6 +435,7 @@ export class SearchView extends ViewPane {
436435

437436
this.searchWidgetsContainerElement = dom.append(this.container, $('.search-widgets-container'));
438437
this.createSearchWidget(this.searchWidgetsContainerElement);
438+
this.refreshHasAISetting();
439439

440440
const history = this.searchHistoryService.load();
441441
const filePatterns = this.viewletState['query.filePatterns'] || '';
@@ -680,7 +680,8 @@ export class SearchView extends ViewPane {
680680
}
681681

682682
private shouldShowAIButton(): boolean {
683-
return !!(this.configurationService.getValue<boolean>('search.aiResults') && this.hasAIResultProvider.get());
683+
const hasProvider = Constants.SearchContext.hasAIResultProvider.getValue(this.contextKeyService);
684+
return !!(this.configurationService.getValue<boolean>('search.aiResults') && hasProvider);
684685
}
685686
private onConfigurationUpdated(event?: IConfigurationChangeEvent): void {
686687
if (event && (event.affectsConfiguration('search.decorations.colors') || event.affectsConfiguration('search.decorations.badges'))) {

0 commit comments

Comments
 (0)