Take Smart Send Out of Experiment (#23067) · love-be/vscode-python@ff4c688 · GitHub
Skip to content

Commit ff4c688

Browse files
authored
Take Smart Send Out of Experiment (microsoft#23067)
Resolves: microsoft#23045
1 parent 3775c93 commit ff4c688

4 files changed

Lines changed: 11 additions & 52 deletions

File tree

‎python_files/normalizeSelection.py‎

Lines changed: 1 addition & 5 deletions

‎src/client/common/experiments/groups.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ export enum DiscoveryUsingWorkers {
1919
export enum EnableTestAdapterRewrite {
2020
experiment = 'pythonTestAdapter',
2121
}
22-
// Experiment to enable smart shift+enter, advance cursor.
23-
export enum EnableREPLSmartSend {
24-
experiment = 'pythonREPLSmartSend',
25-
}
2622

2723
// Experiment to recommend installing the tensorboard extension.
2824
export enum RecommendTensobardExtension {

‎src/client/terminals/codeExecution/helper.ts‎

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import { IInterpreterService } from '../../interpreter/contracts';
2020
import { IServiceContainer } from '../../ioc/types';
2121
import { ICodeExecutionHelper } from '../types';
2222
import { traceError } from '../../logging';
23-
import { IConfigurationService, IExperimentService, Resource } from '../../common/types';
24-
import { EnableREPLSmartSend } from '../../common/experiments/groups';
23+
import { IConfigurationService, Resource } from '../../common/types';
2524
import { sendTelemetryEvent } from '../../telemetry';
2625
import { EventName } from '../../telemetry/constants';
2726

@@ -93,7 +92,6 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
9392
const startLineVal = activeEditor?.selection?.start.line ?? 0;
9493
const endLineVal = activeEditor?.selection?.end.line ?? 0;
9594
const emptyHighlightVal = activeEditor?.selection?.isEmpty ?? true;
96-
const smartSendExperimentEnabledVal = pythonSmartSendEnabled(this.serviceContainer);
9795
let smartSendSettingsEnabledVal = false;
9896
const configuration = this.serviceContainer.get<IConfigurationService>(IConfigurationService);
9997
if (configuration) {
@@ -107,7 +105,6 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
107105
startLine: startLineVal,
108106
endLine: endLineVal,
109107
emptyHighlight: emptyHighlightVal,
110-
smartSendExperimentEnabled: smartSendExperimentEnabledVal,
111108
smartSendSettingsEnabled: smartSendSettingsEnabledVal,
112109
});
113110
observable.proc?.stdin?.write(input);
@@ -117,12 +114,7 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
117114
const result = await normalizeOutput.promise;
118115
const object = JSON.parse(result);
119116

120-
if (
121-
activeEditor?.selection &&
122-
smartSendExperimentEnabledVal &&
123-
smartSendSettingsEnabledVal &&
124-
object.normalized !== 'deprecated'
125-
) {
117+
if (activeEditor?.selection && smartSendSettingsEnabledVal && object.normalized !== 'deprecated') {
126118
const lineOffset = object.nextBlockLineno - activeEditor!.selection.start.line - 1;
127119
await this.moveToNextBlock(lineOffset, activeEditor);
128120
}
@@ -145,16 +137,15 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
145137
*/
146138
// eslint-disable-next-line class-methods-use-this
147139
private async moveToNextBlock(lineOffset: number, activeEditor?: TextEditor): Promise<void> {
148-
if (pythonSmartSendEnabled(this.serviceContainer)) {
149-
if (activeEditor?.selection?.isEmpty) {
150-
await this.commandManager.executeCommand('cursorMove', {
151-
to: 'down',
152-
by: 'line',
153-
value: Number(lineOffset),
154-
});
155-
await this.commandManager.executeCommand('cursorEnd');
156-
}
140+
if (activeEditor?.selection?.isEmpty) {
141+
await this.commandManager.executeCommand('cursorMove', {
142+
to: 'down',
143+
by: 'line',
144+
value: Number(lineOffset),
145+
});
146+
await this.commandManager.executeCommand('cursorEnd');
157147
}
148+
158149
return Promise.resolve();
159150
}
160151

@@ -314,9 +305,3 @@ function getMultiLineSelectionText(textEditor: TextEditor): string {
314305
// ↑<---------------- To here
315306
return selectionText;
316307
}
317-
318-
function pythonSmartSendEnabled(serviceContainer: IServiceContainer): boolean {
319-
const experiment = serviceContainer.get<IExperimentService>(IExperimentService);
320-
321-
return experiment ? experiment.inExperimentSync(EnableREPLSmartSend.experiment) : false;
322-
}

‎src/test/terminals/codeExecution/smartSend.test.ts‎

Lines changed: 0 additions & 18 deletions

0 commit comments

Comments
 (0)