Skip to content

Commit

Permalink
Do not deprecate python.terminal.activateEnvironmentInTerminal sett…
Browse files Browse the repository at this point in the history
…ing along with terminal env var experiment (#20952)

I initially deprecated this setting as I thought folks only disabled it
because we were sending commands which was annoying.
  • Loading branch information
Kartik Raj authored Mar 30, 2023
1 parent 37a70fd commit 96aa8f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
7 changes: 2 additions & 5 deletions src/client/common/terminal/activator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

import { inject, injectable, multiInject } from 'inversify';
import { Terminal } from 'vscode';
import { inTerminalEnvVarExperiment } from '../../experiments/helpers';
import { IConfigurationService, IExperimentService } from '../../types';
import { IConfigurationService } from '../../types';
import { ITerminalActivationHandler, ITerminalActivator, ITerminalHelper, TerminalActivationOptions } from '../types';
import { BaseTerminalActivator } from './base';

Expand All @@ -18,7 +17,6 @@ export class TerminalActivator implements ITerminalActivator {
@inject(ITerminalHelper) readonly helper: ITerminalHelper,
@multiInject(ITerminalActivationHandler) private readonly handlers: ITerminalActivationHandler[],
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
@inject(IExperimentService) private readonly experimentService: IExperimentService,
) {
this.initialize();
}
Expand All @@ -39,8 +37,7 @@ export class TerminalActivator implements ITerminalActivator {
options?: TerminalActivationOptions,
): Promise<boolean> {
const settings = this.configurationService.getSettings(options?.resource);
const activateEnvironment =
settings.terminal.activateEnvironment && !inTerminalEnvVarExperiment(this.experimentService);
const activateEnvironment = settings.terminal.activateEnvironment;
if (!activateEnvironment || options?.hideFromUser) {
return false;
}
Expand Down
17 changes: 2 additions & 15 deletions src/test/common/terminals/activator/index.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,32 @@ import {
ITerminalActivator,
ITerminalHelper,
} from '../../../../client/common/terminal/types';
import {
IConfigurationService,
IExperimentService,
IPythonSettings,
ITerminalSettings,
} from '../../../../client/common/types';
import { IConfigurationService, IPythonSettings, ITerminalSettings } from '../../../../client/common/types';

suite('Terminal Activator', () => {
let activator: TerminalActivator;
let baseActivator: TypeMoq.IMock<ITerminalActivator>;
let handler1: TypeMoq.IMock<ITerminalActivationHandler>;
let handler2: TypeMoq.IMock<ITerminalActivationHandler>;
let terminalSettings: TypeMoq.IMock<ITerminalSettings>;
let experimentService: TypeMoq.IMock<IExperimentService>;
setup(() => {
baseActivator = TypeMoq.Mock.ofType<ITerminalActivator>();
terminalSettings = TypeMoq.Mock.ofType<ITerminalSettings>();
handler1 = TypeMoq.Mock.ofType<ITerminalActivationHandler>();
handler2 = TypeMoq.Mock.ofType<ITerminalActivationHandler>();
const configService = TypeMoq.Mock.ofType<IConfigurationService>();
experimentService = TypeMoq.Mock.ofType<IExperimentService>();
configService
.setup((c) => c.getSettings(TypeMoq.It.isAny()))
.returns(() => {
return ({
terminal: terminalSettings.object,
} as unknown) as IPythonSettings;
});
experimentService.setup((e) => e.inExperimentSync(TypeMoq.It.isAny())).returns(() => false);
activator = new (class extends TerminalActivator {
protected initialize() {
this.baseActivator = baseActivator.object;
}
})(
TypeMoq.Mock.ofType<ITerminalHelper>().object,
[handler1.object, handler2.object],
configService.object,
experimentService.object,
);
})(TypeMoq.Mock.ofType<ITerminalHelper>().object, [handler1.object, handler2.object], configService.object);
});
async function testActivationAndHandlers(
activationSuccessful: boolean,
Expand Down

0 comments on commit 96aa8f8

Please sign in to comment.