mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
fix leaking listeners, track dispoable workbench contributions (#214301)
* fix leaking listener https://github.com/microsoft/vscode/issues/214234 * track disposable workbench contribution and dispose them on shutdown fyi @bpasero https://github.com/microsoft/vscode/issues/214234 * fix leaking listener https://github.com/microsoft/vscode/issues/214234
This commit is contained in:
@@ -383,18 +383,21 @@ export class InlineChatEnabler {
|
||||
|
||||
private readonly _ctxHasProvider: IContextKey<boolean>;
|
||||
|
||||
private readonly _store = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IChatAgentService chatAgentService: IChatAgentService
|
||||
) {
|
||||
this._ctxHasProvider = CTX_INLINE_CHAT_HAS_AGENT.bindTo(contextKeyService);
|
||||
chatAgentService.onDidChangeAgents(() => {
|
||||
this._store.add(chatAgentService.onDidChangeAgents(() => {
|
||||
const hasEditorAgent = Boolean(chatAgentService.getDefaultAgent(ChatAgentLocation.Editor));
|
||||
this._ctxHasProvider.set(hasEditorAgent);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this._ctxHasProvider.reset();
|
||||
this._store.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user