Skip to content

Commit 5d1a4ad

Browse files
authored
Set default logic normalizing code sent to REPL (#15650)
1 parent 14792e3 commit 5d1a4ad

File tree

8 files changed

+10
-409
lines changed

8 files changed

+10
-409
lines changed

news/1 Enhancements/15649.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the updated logic for normalizing code sent to REPL as the default behaviour.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@
10521052
"Reload - experiment",
10531053
"DeprecatePythonPath - experiment",
10541054
"tryPylance",
1055-
"pythonSendEntireLineToREPL",
10561055
"pythonTensorboardExperiment",
10571056
"pythonDiscoveryModule",
10581057
"pythonJediLSP",
@@ -1071,7 +1070,6 @@
10711070
"Reload - experiment",
10721071
"DeprecatePythonPath - experiment",
10731072
"tryPylance",
1074-
"pythonSendEntireLineToREPL",
10751073
"pythonTensorboardExperiment",
10761074
"pythonDiscoveryModule",
10771075
"pythonJediLSP",

pythonFiles/normalizeForInterpreter.py

Lines changed: 0 additions & 158 deletions
This file was deleted.

pythonFiles/tests/test_normalize_for_interpreter.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/client/common/experiments/groups.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ export enum JoinMailingListPromptVariants {
4343
variant3 = 'pythonJoinMailingListVar3',
4444
}
4545

46-
// Experiment to use a different method for normalizing code to be sent to the REPL.
47-
export enum SendSelectionToREPL {
48-
experiment = 'pythonSendEntireLineToREPL',
49-
}
50-
5146
// Feature flag for 'Python: Launch TensorBoard' feature
5247
export enum NativeTensorBoard {
5348
experiment = 'pythonTensorboardExperiment',

src/client/common/process/internal/scripts/index.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,6 @@ export function refactor(root: string): [string[], (out: string) => object[]] {
226226
return [args, parse];
227227
}
228228

229-
//============================
230-
// normalizeForInterpreter.py
231-
232-
export function normalizeForInterpreter(): [string[], (out: string) => string] {
233-
const script = path.join(SCRIPTS_DIR, 'normalizeForInterpreter.py');
234-
const args = maybeIsolated([script]);
235-
236-
function parse(out: string) {
237-
// The text will be used as-is.
238-
return out;
239-
}
240-
241-
return [args, parse];
242-
}
243-
244229
//============================
245230
// normalizeSelection.py
246231

src/client/terminals/codeExecution/helper.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import { Position, Range, TextEditor, Uri } from 'vscode';
77

88
import { IApplicationShell, IDocumentManager } from '../../common/application/types';
99
import { PYTHON_LANGUAGE } from '../../common/constants';
10-
import { SendSelectionToREPL } from '../../common/experiments/groups';
1110
import { traceError } from '../../common/logger';
1211
import * as internalScripts from '../../common/process/internal/scripts';
1312
import { IProcessServiceFactory } from '../../common/process/types';
14-
import { IExperimentService } from '../../common/types';
1513
import { createDeferred } from '../../common/utils/async';
1614
import { IInterpreterService } from '../../interpreter/contracts';
1715
import { IServiceContainer } from '../../ioc/types';
@@ -23,14 +21,12 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
2321
private readonly applicationShell: IApplicationShell;
2422
private readonly processServiceFactory: IProcessServiceFactory;
2523
private readonly interpreterService: IInterpreterService;
26-
private readonly experimentService: IExperimentService;
2724

2825
constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) {
2926
this.documentManager = serviceContainer.get<IDocumentManager>(IDocumentManager);
3027
this.applicationShell = serviceContainer.get<IApplicationShell>(IApplicationShell);
3128
this.processServiceFactory = serviceContainer.get<IProcessServiceFactory>(IProcessServiceFactory);
3229
this.interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);
33-
this.experimentService = serviceContainer.get<IExperimentService>(IExperimentService);
3430
}
3531

3632
public async normalizeLines(code: string, resource?: Uri): Promise<string> {
@@ -45,10 +41,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
4541
const interpreter = await this.interpreterService.getActiveInterpreter(resource);
4642
const processService = await this.processServiceFactory.create(resource);
4743

48-
const inExperiment = await this.experimentService.inExperiment(SendSelectionToREPL.experiment);
49-
const [args, parse] = inExperiment
50-
? internalScripts.normalizeSelection()
51-
: internalScripts.normalizeForInterpreter();
44+
const [args, parse] = internalScripts.normalizeSelection();
5245
const observable = processService.execObservable(interpreter?.path || 'python', args, {
5346
throwOnStdErr: true,
5447
});

0 commit comments

Comments
 (0)