Skip to content

Commit

Permalink
better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Nov 26, 2024
1 parent 1a2d340 commit d7e34a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class MainThreadTerminalShellIntegration extends Disposable implements Ma
const onDidAddCommandDetection = this._store.add(this._terminalService.createOnInstanceEvent(instance => {
return Event.map(
Event.filter(instance.capabilities.onDidAddCapabilityType, e => {
return e === TerminalCapability.CommandDetection;
return e === TerminalCapability.CommandDetection || e === TerminalCapability.CwdDetection;
}), () => instance
);
})).event;
Expand Down
13 changes: 1 addition & 12 deletions src/vs/workbench/api/common/extHostTerminalShellIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export class ExtHostTerminalShellIntegration extends Disposable implements IExtH

protected _proxy: MainThreadTerminalShellIntegrationShape;

private _initialCwd: URI | undefined;

private _activeShellIntegrations: Map</*instanceId*/number, InternalTerminalShellIntegration> = new Map();

protected readonly _onDidChangeTerminalShellIntegration = new Emitter<vscode.TerminalShellIntegrationChangeEvent>();
Expand Down Expand Up @@ -94,9 +92,6 @@ export class ExtHostTerminalShellIntegration extends Disposable implements IExtH
if (!shellIntegration) {
shellIntegration = new InternalTerminalShellIntegration(terminal.value, this._onDidStartTerminalShellExecution);
this._activeShellIntegrations.set(instanceId, shellIntegration);
if (this._initialCwd) {
this._activeShellIntegrations.get(instanceId)?.setCwd(this._initialCwd);
}
shellIntegration.store.add(terminal.onWillDispose(() => this._activeShellIntegrations.get(instanceId)?.dispose()));
shellIntegration.store.add(shellIntegration.onDidRequestShellExecution(commandLine => this._proxy.$executeCommand(instanceId, commandLine)));
shellIntegration.store.add(shellIntegration.onDidRequestEndExecution(e => this._onDidEndTerminalShellExecution.fire(e)));
Expand Down Expand Up @@ -137,13 +132,7 @@ export class ExtHostTerminalShellIntegration extends Disposable implements IExtH
}

public $cwdChange(instanceId: number, cwd: UriComponents | undefined): void {
const activeShellIntegration = this._activeShellIntegrations.get(instanceId);
const revivedCwd = URI.revive(cwd);
if (!activeShellIntegration) {
this._initialCwd = revivedCwd;
} else {
this._activeShellIntegrations.get(instanceId)?.setCwd(revivedCwd);
}
this._activeShellIntegrations.get(instanceId)?.setCwd(URI.revive(cwd));
}

public $closeTerminal(instanceId: number): void {
Expand Down

0 comments on commit d7e34a7

Please sign in to comment.