File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
platform/contextkey/browser Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ class ConfigAwareContextValuesContainer extends Context {
103
103
private static readonly _keyPrefix = 'config.' ;
104
104
105
105
private readonly _values = TernarySearchTree . forConfigKeys < any > ( ) ;
106
+ private readonly _missed = TernarySearchTree . forConfigKeys < boolean > ( ) ;
106
107
private readonly _listener : IDisposable ;
107
108
108
109
constructor (
@@ -117,7 +118,10 @@ class ConfigAwareContextValuesContainer extends Context {
117
118
// new setting, reset everything
118
119
const allKeys = Array . from ( this . _values , ( [ k ] ) => k ) ;
119
120
this . _values . clear ( ) ;
120
- emitter . fire ( new ArrayContextKeyChangeEvent ( allKeys ) ) ;
121
+ emitter . fire ( new CompositeContextKeyChangeEvent ( [
122
+ new ArrayContextKeyChangeEvent ( allKeys ) ,
123
+ new ArrayContextKeyChangeEvent ( Array . from ( this . _missed , ( [ k ] ) => k ) )
124
+ ] ) ) ;
121
125
} else {
122
126
const changedKeys : string [ ] = [ ] ;
123
127
for ( const configKey of event . affectedKeys ) {
@@ -172,6 +176,11 @@ class ConfigAwareContextValuesContainer extends Context {
172
176
}
173
177
174
178
this . _values . set ( key , value ) ;
179
+ if ( value === undefined ) {
180
+ this . _missed . set ( key , true ) ;
181
+ } else {
182
+ this . _missed . delete ( key ) ;
183
+ }
175
184
return value ;
176
185
}
177
186
Original file line number Diff line number Diff line change @@ -67,7 +67,10 @@ export class LanguageModelToolsService extends Disposable implements ILanguageMo
67
67
this . _tools . set ( toolData . id , { data : toolData } ) ;
68
68
this . _onDidChangeToolsScheduler . schedule ( ) ;
69
69
70
- toolData . when ?. keys ( ) . forEach ( key => this . _toolContextKeys . add ( key ) ) ;
70
+ if ( toolData . when ) {
71
+ this . _contextKeyService . contextMatchesRules ( toolData . when ) ;
72
+ toolData . when . keys ( ) . forEach ( key => this . _toolContextKeys . add ( key ) ) ;
73
+ }
71
74
72
75
return toDisposable ( ( ) => {
73
76
this . _tools . delete ( toolData . id ) ;
Original file line number Diff line number Diff line change @@ -307,6 +307,8 @@ export class ChatAgentService extends Disposable implements IChatAgentService {
307
307
this . _agents . set ( id , entry ) ;
308
308
this . _updateAgentsContextKeys ( ) ;
309
309
this . _updateContextKeys ( ) ;
310
+ this . _agentIsEnabled ( entry ) ;
311
+
310
312
this . _onDidChangeAgents . fire ( undefined ) ;
311
313
312
314
return toDisposable ( ( ) => {
You can’t perform that action at this time.
0 commit comments