Skip to content

Commit c7b80e3

Browse files
committed
Disable PyREPL
1 parent e5e5241 commit c7b80e3

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/client/extensionActivation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { DebuggerTypeName } from './debugger/constants';
5353
import { StopWatch } from './common/utils/stopWatch';
5454
import { registerReplCommands, registerReplExecuteOnEnter, registerStartNativeReplCommand } from './repl/replCommands';
5555
import { registerTriggerForTerminalREPL } from './terminals/codeExecution/terminalReplWatcher';
56-
import { registerPythonStartup } from './terminals/pythonStartup';
56+
import { registerBasicRepl, registerPythonStartup } from './terminals/pythonStartup';
5757
import { registerPixiFeatures } from './pythonEnvironments/common/environmentManagers/pixi';
5858
import { registerCustomTerminalLinkProvider } from './terminals/pythonStartupLinkProvider';
5959
import { registerEnvExtFeatures } from './envExt/api.internal';
@@ -184,6 +184,7 @@ async function activateLegacy(ext: ExtensionState, startupStopWatch: StopWatch):
184184
serviceManager.get<ITerminalAutoActivation>(ITerminalAutoActivation).register();
185185

186186
await registerPythonStartup(ext.context);
187+
await registerBasicRepl(ext.context);
187188

188189
serviceManager.get<ICodeExecutionManager>(ICodeExecutionManager).registerCommands();
189190

src/client/terminals/codeExecution/helper.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,6 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
124124
const lineOffset = object.nextBlockLineno - activeEditor!.selection.start.line - 1;
125125
await this.moveToNextBlock(lineOffset, activeEditor);
126126
}
127-
// For new _pyrepl for Python3.13 and above, we need to send code via bracketed paste mode.
128-
if (object.attach_bracket_paste && replType === ReplType.terminal) {
129-
let trimmedNormalized = object.normalized.replace(/\n$/, '');
130-
if (trimmedNormalized.endsWith(':\n')) {
131-
// In case where statement is unfinished via :, truncate so auto-indentation lands nicely.
132-
trimmedNormalized = trimmedNormalized.replace(/\n$/, '');
133-
}
134-
return `\u001b[200~${trimmedNormalized}\u001b[201~`;
135-
}
136127

137128
return parse(object.normalized);
138129
} catch (ex) {

src/client/terminals/pythonStartup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ export async function registerPythonStartup(context: ExtensionContext): Promise<
3636
}),
3737
);
3838
}
39+
40+
export async function registerBasicRepl(context: ExtensionContext): Promise<void> {
41+
// TODO: Configurable by setting
42+
context.environmentVariableCollection.replace('PYTHON_BASIC_REPL', '1');
43+
}

src/test/terminals/shellIntegration/pythonStartup.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
135135
globalEnvironmentVariableCollection.verify((c) => c.delete('PYTHONSTARTUP'), TypeMoq.Times.once());
136136
});
137137

138+
test('PYTHON_BASIC_REPL is set when registerBasicRepl is called', async () => {
139+
await registerPythonStartup(context.object);
140+
globalEnvironmentVariableCollection.verify(
141+
(c) => c.replace('PYTHON_BASIC_REPL', '1', TypeMoq.It.isAny()),
142+
TypeMoq.Times.once(),
143+
);
144+
});
145+
138146
test('Ensure registering terminal link calls registerTerminalLinkProvider', async () => {
139147
const registerTerminalLinkProviderStub = sinon.stub(
140148
pythonStartupLinkProvider,

0 commit comments

Comments
 (0)