Skip to content

Commit 20a1aca

Browse files
authored
add listeners to correct disposables (microsoft#254891)
fix microsoft#254890
1 parent e42d3b2 commit 20a1aca

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export class MainThreadTerminalShellIntegration extends Disposable implements Ma
114114

115115
private _enableShellIntegration(instance: ITerminalInstance): void {
116116
this._extensionService.activateByEvent('onTerminalShellIntegration:*');
117-
this._register(instance.onDidChangeShellType(() => this._extensionService.activateByEvent(`onTerminalShellIntegration:${instance.shellType}`)));
118117
if (instance.shellType) {
119118
this._extensionService.activateByEvent(`onTerminalShellIntegration:${instance.shellType}`);
120119
}

src/vs/workbench/contrib/terminal/browser/terminalService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,12 @@ export class TerminalService extends Disposable implements ITerminalService {
846846
}));
847847
instanceDisposables.add(instance.onDidFocus(this._onDidChangeActiveInstance.fire, this._onDidChangeActiveInstance));
848848
instanceDisposables.add(instance.onRequestAddInstanceToGroup(async e => await this._addInstanceToGroup(instance, e)));
849+
instanceDisposables.add(instance.onDidChangeShellType(() => this._extensionService.activateByEvent(`onTerminal:${instance.shellType}`)));
850+
instanceDisposables.add(Event.runAndSubscribe(instance.capabilities.onDidAddCapability, (() => {
851+
if (instance.capabilities.has(TerminalCapability.CommandDetection)) {
852+
this._extensionService.activateByEvent(`onTerminalShellIntegration:${instance.shellType}`);
853+
}
854+
})));
849855
const disposeListener = this._register(instance.onDisposed(() => {
850856
instanceDisposables.dispose();
851857
this._store.delete(disposeListener);
@@ -1024,7 +1030,6 @@ export class TerminalService extends Disposable implements ITerminalService {
10241030
} else {
10251031
instance = this._createTerminal(shellLaunchConfig, location, options);
10261032
}
1027-
this._register(instance.onDidChangeShellType(() => this._extensionService.activateByEvent(`onTerminal:${instance.shellType}`)));
10281033
if (instance.shellType) {
10291034
this._extensionService.activateByEvent(`onTerminal:${instance.shellType}`);
10301035
}

0 commit comments

Comments
 (0)