Skip to content

Commit ed1d678

Browse files
committed
add onDidChangeConfiguration to track setting change
1 parent b4aa112 commit ed1d678

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/client/terminals/pythonStartup.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import { ExtensionContext, Uri } from 'vscode';
55
import * as path from 'path';
6-
import { copy, createDirectory, getConfiguration } from '../common/vscodeApis/workspaceApis';
6+
import { copy, createDirectory, getConfiguration, onDidChangeConfiguration } from '../common/vscodeApis/workspaceApis';
77
import { EXTENSION_ROOT_DIR } from '../constants';
88

9-
export async function registerPythonStartup(context: ExtensionContext): Promise<void> {
9+
async function applyPythonStartupSetting(context: ExtensionContext): Promise<void> {
1010
const config = getConfiguration('python');
1111
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
1212

@@ -25,3 +25,14 @@ export async function registerPythonStartup(context: ExtensionContext): Promise<
2525
context.environmentVariableCollection.delete('PYTHONSTARTUP');
2626
}
2727
}
28+
29+
export async function registerPythonStartup(context: ExtensionContext): Promise<void> {
30+
await applyPythonStartupSetting(context);
31+
context.subscriptions.push(
32+
onDidChangeConfiguration(async (e) => {
33+
if (e.affectsConfiguration('python.terminal.shellIntegration.enabled')) {
34+
await applyPythonStartupSetting(context);
35+
}
36+
}),
37+
);
38+
}

0 commit comments

Comments
 (0)