Skip to content

Set default logic normalizing code sent to REPL #15650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1 Enhancements/15649.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use the updated logic for normalizing code sent to REPL as the default behaviour.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,6 @@
"Reload - experiment",
"DeprecatePythonPath - experiment",
"tryPylance",
"pythonSendEntireLineToREPL",
"pythonTensorboardExperiment",
"pythonDiscoveryModule",
"pythonJediLSP",
Expand All @@ -1067,7 +1066,6 @@
"Reload - experiment",
"DeprecatePythonPath - experiment",
"tryPylance",
"pythonSendEntireLineToREPL",
"pythonTensorboardExperiment",
"pythonDiscoveryModule",
"pythonJediLSP",
Expand Down
158 changes: 0 additions & 158 deletions pythonFiles/normalizeForInterpreter.py

This file was deleted.

97 changes: 0 additions & 97 deletions pythonFiles/tests/test_normalize_for_interpreter.py

This file was deleted.

5 changes: 0 additions & 5 deletions src/client/common/experiments/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ export enum JoinMailingListPromptVariants {
variant3 = 'pythonJoinMailingListVar3',
}

// Experiment to use a different method for normalizing code to be sent to the REPL.
export enum SendSelectionToREPL {
experiment = 'pythonSendEntireLineToREPL',
}

// Feature flag for 'Python: Launch TensorBoard' feature
export enum NativeTensorBoard {
experiment = 'pythonTensorboardExperiment',
Expand Down
15 changes: 0 additions & 15 deletions src/client/common/process/internal/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,6 @@ export function refactor(root: string): [string[], (out: string) => object[]] {
return [args, parse];
}

//============================
// normalizeForInterpreter.py

export function normalizeForInterpreter(): [string[], (out: string) => string] {
const script = path.join(SCRIPTS_DIR, 'normalizeForInterpreter.py');
const args = maybeIsolated([script]);

function parse(out: string) {
// The text will be used as-is.
return out;
}

return [args, parse];
}

//============================
// normalizeSelection.py

Expand Down
9 changes: 1 addition & 8 deletions src/client/terminals/codeExecution/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { Position, Range, TextEditor, Uri } from 'vscode';

import { IApplicationShell, IDocumentManager } from '../../common/application/types';
import { PYTHON_LANGUAGE } from '../../common/constants';
import { SendSelectionToREPL } from '../../common/experiments/groups';
import { traceError } from '../../common/logger';
import * as internalScripts from '../../common/process/internal/scripts';
import { IProcessServiceFactory } from '../../common/process/types';
import { IExperimentService } from '../../common/types';
import { createDeferred } from '../../common/utils/async';
import { IInterpreterService } from '../../interpreter/contracts';
import { IServiceContainer } from '../../ioc/types';
Expand All @@ -23,14 +21,12 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
private readonly applicationShell: IApplicationShell;
private readonly processServiceFactory: IProcessServiceFactory;
private readonly interpreterService: IInterpreterService;
private readonly experimentService: IExperimentService;

constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) {
this.documentManager = serviceContainer.get<IDocumentManager>(IDocumentManager);
this.applicationShell = serviceContainer.get<IApplicationShell>(IApplicationShell);
this.processServiceFactory = serviceContainer.get<IProcessServiceFactory>(IProcessServiceFactory);
this.interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);
this.experimentService = serviceContainer.get<IExperimentService>(IExperimentService);
}

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

const inExperiment = await this.experimentService.inExperiment(SendSelectionToREPL.experiment);
const [args, parse] = inExperiment
? internalScripts.normalizeSelection()
: internalScripts.normalizeForInterpreter();
const [args, parse] = internalScripts.normalizeSelection();
const observable = processService.execObservable(interpreter?.path || 'python', args, {
throwOnStdErr: true,
});
Expand Down
Loading