Hook up contribution dispose

This commit is contained in:
Daniel Imms 2023-03-01 16:23:52 -08:00
parent 62df9971f5
commit b2be676a6b
No known key found for this signature in database
GPG key ID: E5CF412B63651C69
2 changed files with 7 additions and 1 deletions

View file

@ -595,6 +595,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
contribution.xtermReady?.(xterm);
}
});
this.onDisposed(() => {
for (const contribution of this._contributions) {
contribution.dispose();
}
});
}
}

View file

@ -15,7 +15,7 @@ import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
import { registerTerminalContribution } from 'vs/workbench/contrib/terminal/browser/terminalCommon';
registerSingleton(ITerminalLinkResolverService, TerminalLinkResolverService, InstantiationType.Delayed);
@ -24,6 +24,7 @@ class TerminalLinkContribution extends DisposableStore implements ITerminalContr
constructor(instance: ITerminalInstance) {
super();
console.log('ctor');
this.add(toDisposable(() => console.log('dispose')));
}
xtermReady(xterm: IXtermTerminal): void {
console.log('xtermReady');