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:
Johannes Rieken
2024-06-05 08:38:34 +02:00
committed by GitHub
parent 539e22e69a
commit 1c967bb7c6
3 changed files with 19 additions and 8 deletions

View File

@@ -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();
}
}