Skip to content

Commit a8067d2

Browse files
committed
Use sendText to send commands to REPL
1 parent d14ccc2 commit a8067d2

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/client/common/terminal/service.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ import {
2020
TerminalShellType,
2121
} from './types';
2222
import { traceVerbose } from '../../logging';
23-
import { getConfiguration } from '../vscodeApis/workspaceApis';
2423
import { useEnvExtension } from '../../envExt/api.internal';
2524
import { ensureTerminalLegacy } from '../../envExt/api.legacy';
2625
import { sleep } from '../utils/async';
27-
import { isWindows } from '../utils/platform';
28-
import { getPythonMinorVersion } from '../../repl/replUtils';
2926

3027
@injectable()
3128
export class TerminalService implements ITerminalService, Disposable {
@@ -108,20 +105,10 @@ export class TerminalService implements ITerminalService, Disposable {
108105
await promise;
109106
}
110107

111-
const config = getConfiguration('python');
112-
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
113-
114-
const minorVersion = this.options?.resource
115-
? await getPythonMinorVersion(
116-
this.options.resource,
117-
this.serviceContainer.get<IInterpreterService>(IInterpreterService),
118-
)
119-
: undefined;
120-
121-
if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows()) || (minorVersion ?? 0) >= 13) {
122-
// If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL.
108+
if (isPythonShell) {
109+
// Prevent KeyboardInterrupt in Python REPL: https://github.com/microsoft/vscode-python/issues/25468
123110
terminal.sendText(commandLine);
124-
return undefined;
111+
traceVerbose(`Python REPL detected, sendText: ${commandLine}`);
125112
} else if (terminal.shellIntegration) {
126113
const execution = terminal.shellIntegration.executeCommand(commandLine);
127114
traceVerbose(`Shell Integration is enabled, executeCommand: ${commandLine}`);

0 commit comments

Comments
 (0)