Skip to content

Commit f922863

Browse files
committed
fix: handle terminal on change to shell startup
1 parent 74feffc commit f922863

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/features/terminal/terminalManager.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
terminals,
1111
withProgress,
1212
} from '../../common/window.apis';
13-
import { getConfiguration } from '../../common/workspace.apis';
13+
import { getConfiguration, onDidChangeConfiguration } from '../../common/workspace.apis';
1414
import { isActivatableEnvironment } from '../common/activation';
1515
import { identifyTerminalShell } from '../common/shellDetector';
1616
import { getPythonApi } from '../pythonApi';
@@ -102,6 +102,23 @@ export class TerminalManagerImpl implements TerminalManager {
102102
this.ta.onDidChangeTerminalActivationState((e) => {
103103
this.onDidChangeTerminalActivationStateEmitter.fire(e);
104104
}),
105+
onDidChangeConfiguration(async (e) => {
106+
if (e.affectsConfiguration('python-envs.terminal.autoActivationType')) {
107+
const actType = getAutoActivationType();
108+
if (actType === 'shellStartup') {
109+
traceInfo(`Auto activation type changed to ${actType}`);
110+
const shells = new Set(
111+
terminals()
112+
.map((t) => identifyTerminalShell(t))
113+
.filter((t) => t !== 'unknown'),
114+
);
115+
await handleSettingUpShellProfileMultiple(
116+
this.startupScriptProviders.filter((p) => shells.has(p.shellType)),
117+
(p, v) => this.shellSetup.set(p.shellType, v),
118+
);
119+
}
120+
}
121+
}),
105122
);
106123
}
107124

0 commit comments

Comments
 (0)