@@ -125,7 +125,6 @@ export class SearchView extends ViewPane {
125
125
private hasReplacePatternKey : IContextKey < boolean > ;
126
126
private hasFilePatternKey : IContextKey < boolean > ;
127
127
private hasSomeCollapsibleResultKey : IContextKey < boolean > ;
128
- private hasAIResultProvider : IContextKey < boolean > ;
129
128
130
129
private tree ! : WorkbenchCompressibleObjectTree < RenderableMatch > ;
131
130
private treeLabels ! : ResourceLabels ;
@@ -221,10 +220,10 @@ export class SearchView extends ViewPane {
221
220
this . hasSomeCollapsibleResultKey = Constants . SearchContext . ViewHasSomeCollapsibleKey . bindTo ( this . contextKeyService ) ;
222
221
this . treeViewKey = Constants . SearchContext . InTreeViewKey . bindTo ( this . contextKeyService ) ;
223
222
this . aiResultsVisibleKey = Constants . SearchContext . AIResultsVisibleKey . bindTo ( this . contextKeyService ) ;
224
- this . hasAIResultProvider = Constants . SearchContext . hasAIResultProvider . bindTo ( this . contextKeyService ) ;
225
223
226
224
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 ) ) ) {
228
227
this . refreshHasAISetting ( ) ;
229
228
}
230
229
} ) ) ;
@@ -436,6 +435,7 @@ export class SearchView extends ViewPane {
436
435
437
436
this . searchWidgetsContainerElement = dom . append ( this . container , $ ( '.search-widgets-container' ) ) ;
438
437
this . createSearchWidget ( this . searchWidgetsContainerElement ) ;
438
+ this . refreshHasAISetting ( ) ;
439
439
440
440
const history = this . searchHistoryService . load ( ) ;
441
441
const filePatterns = this . viewletState [ 'query.filePatterns' ] || '' ;
@@ -680,7 +680,8 @@ export class SearchView extends ViewPane {
680
680
}
681
681
682
682
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 ) ;
684
685
}
685
686
private onConfigurationUpdated ( event ?: IConfigurationChangeEvent ) : void {
686
687
if ( event && ( event . affectsConfiguration ( 'search.decorations.colors' ) || event . affectsConfiguration ( 'search.decorations.badges' ) ) ) {
0 commit comments