Skip to content

Commit ddc765e

Browse files
author
Kartik Raj
authored
Fix wording in conda inherit env prompt (#20627)
Closes #19001
1 parent 401418a commit ddc765e

File tree

4 files changed

+13
-77
lines changed

4 files changed

+13
-77
lines changed

src/client/common/utils/localize.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export namespace Diagnostics {
4848
}
4949

5050
export namespace Common {
51+
export const allow = l10n.t('Allow');
52+
export const close = l10n.t('Close');
5153
export const bannerLabelYes = l10n.t('Yes');
5254
export const bannerLabelNo = l10n.t('No');
5355
export const yesPlease = l10n.t('Yes, please');
@@ -189,7 +191,7 @@ export namespace Interpreters {
189191
export const discovering = l10n.t('Discovering Python Interpreters');
190192
export const refreshing = l10n.t('Refreshing Python Interpreters');
191193
export const condaInheritEnvMessage = l10n.t(
192-
'We noticed you\'re using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change "terminal.integrated.inheritEnv" to false in your user settings.',
194+
'We noticed you\'re using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change "terminal.integrated.inheritEnv" to false in your user settings. [Learn more](https://aka.ms/AA66i8f).',
193195
);
194196
export const activatedCondaEnvLaunch = l10n.t(
195197
'We noticed VS Code was launched from an activated conda environment, would you like to select it?',

src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ConfigurationTarget, Uri } from 'vscode';
66
import { IExtensionActivationService } from '../../activation/types';
77
import { IApplicationEnvironment, IApplicationShell, IWorkspaceService } from '../../common/application/types';
88
import { IPlatformService } from '../../common/platform/types';
9-
import { IBrowserService, IPersistentStateFactory } from '../../common/types';
9+
import { IPersistentStateFactory } from '../../common/types';
1010
import { Common, Interpreters } from '../../common/utils/localize';
1111
import { traceDecoratorError, traceError } from '../../logging';
1212
import { EnvironmentType } from '../../pythonEnvironments/info';
@@ -22,7 +22,6 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService {
2222
constructor(
2323
@inject(IInterpreterService) private readonly interpreterService: IInterpreterService,
2424
@inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService,
25-
@inject(IBrowserService) private browserService: IBrowserService,
2625
@inject(IApplicationShell) private readonly appShell: IApplicationShell,
2726
@inject(IPersistentStateFactory) private readonly persistentStateFactory: IPersistentStateFactory,
2827
@inject(IPlatformService) private readonly platformService: IPlatformService,
@@ -52,8 +51,8 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService {
5251
if (!notificationPromptEnabled.value) {
5352
return;
5453
}
55-
const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.moreInfo];
56-
const telemetrySelections: ['Yes', 'No', 'More Info'] = ['Yes', 'No', 'More Info'];
54+
const prompts = [Common.allow, Common.close];
55+
const telemetrySelections: ['Allow', 'Close'] = ['Allow', 'Close'];
5756
const selection = await this.appShell.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts);
5857
sendTelemetryEvent(EventName.CONDA_INHERIT_ENV_PROMPT, undefined, {
5958
selection: selection ? telemetrySelections[prompts.indexOf(selection)] : undefined,
@@ -67,8 +66,6 @@ export class CondaInheritEnvPrompt implements IExtensionActivationService {
6766
.update('integrated.inheritEnv', false, ConfigurationTarget.Global);
6867
} else if (selection === prompts[1]) {
6968
await notificationPromptEnabled.updateValue(false);
70-
} else if (selection === prompts[2]) {
71-
this.browserService.launch('https://aka.ms/AA66i8f');
7269
}
7370
}
7471

src/client/telemetry/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,11 +1310,10 @@ export interface IEventNamePropertyMapping {
13101310
*/
13111311
[EventName.CONDA_INHERIT_ENV_PROMPT]: {
13121312
/**
1313-
* `Yes` When 'Yes' option is selected
1314-
* `No` When 'No' option is selected
1315-
* `More info` When 'More Info' option is selected
1313+
* `Yes` When 'Allow' option is selected
1314+
* `Close` When 'Close' option is selected
13161315
*/
1317-
selection: 'Yes' | 'No' | 'More Info' | undefined;
1316+
selection: 'Allow' | 'Close' | undefined;
13181317
};
13191318
/**
13201319
* Telemetry event sent with details when user clicks the prompt with the following message:

src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../../../client/common/application/types';
1616
import { PersistentStateFactory } from '../../../client/common/persistentState';
1717
import { IPlatformService } from '../../../client/common/platform/types';
18-
import { IBrowserService, IPersistentState, IPersistentStateFactory } from '../../../client/common/types';
18+
import { IPersistentState, IPersistentStateFactory } from '../../../client/common/types';
1919
import { createDeferred, createDeferredFromPromise, sleep } from '../../../client/common/utils/async';
2020
import { Common, Interpreters } from '../../../client/common/utils/localize';
2121
import { IInterpreterService } from '../../../client/interpreter/contracts';
@@ -31,7 +31,6 @@ suite('Conda Inherit Env Prompt', async () => {
3131
let appShell: TypeMoq.IMock<IApplicationShell>;
3232
let interpreterService: TypeMoq.IMock<IInterpreterService>;
3333
let platformService: TypeMoq.IMock<IPlatformService>;
34-
let browserService: TypeMoq.IMock<IBrowserService>;
3534
let applicationEnvironment: TypeMoq.IMock<IApplicationEnvironment>;
3635
let persistentStateFactory: IPersistentStateFactory;
3736
let notificationPromptEnabled: TypeMoq.IMock<IPersistentState<any>>;
@@ -46,7 +45,6 @@ suite('Conda Inherit Env Prompt', async () => {
4645
setup(() => {
4746
workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>();
4847
appShell = TypeMoq.Mock.ofType<IApplicationShell>();
49-
browserService = TypeMoq.Mock.ofType<IBrowserService>();
5048
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
5149
persistentStateFactory = mock(PersistentStateFactory);
5250
platformService = TypeMoq.Mock.ofType<IPlatformService>();
@@ -55,10 +53,8 @@ suite('Conda Inherit Env Prompt', async () => {
5553
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
5654
interpreterService.object,
5755
workspaceService.object,
58-
browserService.object,
5956
appShell.object,
6057
instance(persistentStateFactory),
61-
6258
platformService.object,
6359
applicationEnvironment.object,
6460
);
@@ -67,10 +63,8 @@ suite('Conda Inherit Env Prompt', async () => {
6763
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
6864
interpreterService.object,
6965
workspaceService.object,
70-
browserService.object,
7166
appShell.object,
7267
instance(persistentStateFactory),
73-
7468
platformService.object,
7569
applicationEnvironment.object,
7670
true,
@@ -260,7 +254,6 @@ suite('Conda Inherit Env Prompt', async () => {
260254
setup(() => {
261255
workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>();
262256
appShell = TypeMoq.Mock.ofType<IApplicationShell>();
263-
browserService = TypeMoq.Mock.ofType<IBrowserService>();
264257
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
265258
persistentStateFactory = mock(PersistentStateFactory);
266259
platformService = TypeMoq.Mock.ofType<IPlatformService>();
@@ -279,7 +272,6 @@ suite('Conda Inherit Env Prompt', async () => {
279272
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
280273
interpreterService.object,
281274
workspaceService.object,
282-
browserService.object,
283275
appShell.object,
284276
instance(persistentStateFactory),
285277

@@ -305,7 +297,6 @@ suite('Conda Inherit Env Prompt', async () => {
305297
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
306298
interpreterService.object,
307299
workspaceService.object,
308-
browserService.object,
309300
appShell.object,
310301
instance(persistentStateFactory),
311302

@@ -323,7 +314,6 @@ suite('Conda Inherit Env Prompt', async () => {
323314
setup(() => {
324315
workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>();
325316
appShell = TypeMoq.Mock.ofType<IApplicationShell>();
326-
browserService = TypeMoq.Mock.ofType<IBrowserService>();
327317
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
328318
persistentStateFactory = mock(PersistentStateFactory);
329319
platformService = TypeMoq.Mock.ofType<IPlatformService>();
@@ -343,7 +333,6 @@ suite('Conda Inherit Env Prompt', async () => {
343333
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
344334
interpreterService.object,
345335
workspaceService.object,
346-
browserService.object,
347336
appShell.object,
348337
instance(persistentStateFactory),
349338

@@ -363,7 +352,6 @@ suite('Conda Inherit Env Prompt', async () => {
363352
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
364353
interpreterService.object,
365354
workspaceService.object,
366-
browserService.object,
367355
appShell.object,
368356
instance(persistentStateFactory),
369357

@@ -377,13 +365,12 @@ suite('Conda Inherit Env Prompt', async () => {
377365
});
378366

379367
suite('Method promptAndUpdate()', () => {
380-
const prompts = [Common.bannerLabelYes, Common.bannerLabelNo, Common.moreInfo];
368+
const prompts = [Common.allow, Common.close];
381369
setup(() => {
382370
workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>();
383371
appShell = TypeMoq.Mock.ofType<IApplicationShell>();
384372
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
385373
persistentStateFactory = mock(PersistentStateFactory);
386-
browserService = TypeMoq.Mock.ofType<IBrowserService>();
387374
notificationPromptEnabled = TypeMoq.Mock.ofType<IPersistentState<any>>();
388375
platformService = TypeMoq.Mock.ofType<IPlatformService>();
389376
applicationEnvironment = TypeMoq.Mock.ofType<IApplicationEnvironment>();
@@ -394,7 +381,6 @@ suite('Conda Inherit Env Prompt', async () => {
394381
condaInheritEnvPrompt = new CondaInheritEnvPrompt(
395382
interpreterService.object,
396383
workspaceService.object,
397-
browserService.object,
398384
appShell.object,
399385
instance(persistentStateFactory),
400386

@@ -439,16 +425,11 @@ suite('Conda Inherit Env Prompt', async () => {
439425
.setup((n) => n.updateValue(false))
440426
.returns(() => Promise.resolve(undefined))
441427
.verifiable(TypeMoq.Times.never());
442-
browserService
443-
.setup((b) => b.launch('https://aka.ms/AA66i8f'))
444-
.returns(() => undefined)
445-
.verifiable(TypeMoq.Times.never());
446428
await condaInheritEnvPrompt.promptAndUpdate();
447429
verify(persistentStateFactory.createGlobalPersistentState(condaInheritEnvPromptKey, true)).once();
448430
verifyAll();
449431
workspaceConfig.verifyAll();
450432
notificationPromptEnabled.verifyAll();
451-
browserService.verifyAll();
452433
});
453434
test('Update terminal settings if `Yes` is selected', async () => {
454435
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
@@ -458,7 +439,7 @@ suite('Conda Inherit Env Prompt', async () => {
458439
.verifiable(TypeMoq.Times.once());
459440
appShell
460441
.setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts))
461-
.returns(() => Promise.resolve(Common.bannerLabelYes))
442+
.returns(() => Promise.resolve(Common.allow))
462443
.verifiable(TypeMoq.Times.once());
463444
workspaceService
464445
.setup((ws) => ws.getConfiguration('terminal'))
@@ -472,16 +453,11 @@ suite('Conda Inherit Env Prompt', async () => {
472453
.setup((n) => n.updateValue(false))
473454
.returns(() => Promise.resolve(undefined))
474455
.verifiable(TypeMoq.Times.never());
475-
browserService
476-
.setup((b) => b.launch('https://aka.ms/AA66i8f'))
477-
.returns(() => undefined)
478-
.verifiable(TypeMoq.Times.never());
479456
await condaInheritEnvPrompt.promptAndUpdate();
480457
verify(persistentStateFactory.createGlobalPersistentState(condaInheritEnvPromptKey, true)).once();
481458
verifyAll();
482459
workspaceConfig.verifyAll();
483460
notificationPromptEnabled.verifyAll();
484-
browserService.verifyAll();
485461
});
486462
test('Disable notification prompt if `No` is selected', async () => {
487463
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
@@ -491,40 +467,7 @@ suite('Conda Inherit Env Prompt', async () => {
491467
.verifiable(TypeMoq.Times.once());
492468
appShell
493469
.setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts))
494-
.returns(() => Promise.resolve(Common.bannerLabelNo))
495-
.verifiable(TypeMoq.Times.once());
496-
workspaceService
497-
.setup((ws) => ws.getConfiguration('terminal'))
498-
.returns(() => workspaceConfig.object)
499-
.verifiable(TypeMoq.Times.never());
500-
workspaceConfig
501-
.setup((wc) => wc.update('integrated.inheritEnv', false, ConfigurationTarget.Global))
502-
.returns(() => Promise.resolve())
503-
.verifiable(TypeMoq.Times.never());
504-
notificationPromptEnabled
505-
.setup((n) => n.updateValue(false))
506-
.returns(() => Promise.resolve(undefined))
507-
.verifiable(TypeMoq.Times.once());
508-
browserService
509-
.setup((b) => b.launch('https://aka.ms/AA66i8f'))
510-
.returns(() => undefined)
511-
.verifiable(TypeMoq.Times.never());
512-
await condaInheritEnvPrompt.promptAndUpdate();
513-
verify(persistentStateFactory.createGlobalPersistentState(condaInheritEnvPromptKey, true)).once();
514-
verifyAll();
515-
workspaceConfig.verifyAll();
516-
notificationPromptEnabled.verifyAll();
517-
browserService.verifyAll();
518-
});
519-
test('Launch browser if `More info` option is selected', async () => {
520-
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
521-
notificationPromptEnabled
522-
.setup((n) => n.value)
523-
.returns(() => true)
524-
.verifiable(TypeMoq.Times.once());
525-
appShell
526-
.setup((a) => a.showInformationMessage(Interpreters.condaInheritEnvMessage, ...prompts))
527-
.returns(() => Promise.resolve(Common.moreInfo))
470+
.returns(() => Promise.resolve(Common.close))
528471
.verifiable(TypeMoq.Times.once());
529472
workspaceService
530473
.setup((ws) => ws.getConfiguration('terminal'))
@@ -537,17 +480,12 @@ suite('Conda Inherit Env Prompt', async () => {
537480
notificationPromptEnabled
538481
.setup((n) => n.updateValue(false))
539482
.returns(() => Promise.resolve(undefined))
540-
.verifiable(TypeMoq.Times.never());
541-
browserService
542-
.setup((b) => b.launch('https://aka.ms/AA66i8f'))
543-
.returns(() => undefined)
544483
.verifiable(TypeMoq.Times.once());
545484
await condaInheritEnvPrompt.promptAndUpdate();
546485
verify(persistentStateFactory.createGlobalPersistentState(condaInheritEnvPromptKey, true)).once();
547486
verifyAll();
548487
workspaceConfig.verifyAll();
549488
notificationPromptEnabled.verifyAll();
550-
browserService.verifyAll();
551489
});
552490
});
553491
});

0 commit comments

Comments
 (0)