Skip to content

Commit 1187591

Browse files
committed
use sendText for >=3.13
1 parent 803704e commit 1187591

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/client/common/terminal/service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useEnvExtension } from '../../envExt/api.internal';
2525
import { ensureTerminalLegacy } from '../../envExt/api.legacy';
2626
import { sleep } from '../utils/async';
2727
import { isWindows } from '../utils/platform';
28+
import { getActiveInterpreter } from '../../repl/replUtils';
2829

2930
@injectable()
3031
export class TerminalService implements ITerminalService, Disposable {
@@ -108,7 +109,17 @@ export class TerminalService implements ITerminalService, Disposable {
108109

109110
const config = getConfiguration('python');
110111
const pythonrcSetting = config.get<boolean>('terminal.shellIntegration.enabled');
111-
if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows())) {
112+
113+
// Need to check for if Python version is >= 3.13 since we have turned off SI on python side.
114+
// Because we are not sending explicit commandline info to core, it will inject ^C. (We want to avoid)
115+
if (this.options && this.options.resource) {
116+
const pythonVersion = await getActiveInterpreter(
117+
this.options.resource,
118+
this.serviceContainer.get<IInterpreterService>(IInterpreterService),
119+
);
120+
const minorVersion = pythonVersion?.version?.minor;
121+
122+
if ((isPythonShell && !pythonrcSetting) || (isPythonShell && isWindows()) || ((minorVersion ?? 0) >= 13)) {
112123
// If user has explicitly disabled SI for Python, use sendText for inside Terminal REPL.
113124
terminal.sendText(commandLine);
114125
return undefined;

0 commit comments

Comments
 (0)