Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Mar 16, 2023
1 parent 5ffb3f8 commit db04ec6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ export namespace ToolsExtensions {
);

export const installBlackFormatterPrompt = l10n.t(
'You triggered formatting with Black, would you like to install one of the formatter extensions? This will also set it as the default formatter for python.',
'You triggered formatting with Black, would you like to install one of our new formatter extensions? This will also set it as the default formatter for Python.',
);

export const installAutopep8FormatterPrompt = l10n.t(
'You triggered formatting with Autopep8, would you like to install one of the formatter extension? This will also set it as the default formatter for python.',
'You triggered formatting with Autopep8, would you like to install one of our new formatter extension? This will also set it as the default formatter for Python.',
);
}
2 changes: 1 addition & 1 deletion src/client/providers/prompts/installFormatterPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class InstallFormatterPrompt implements IInstallFormatterPrompt {
constructor(private readonly serviceContainer: IServiceContainer) {}

public async showInstallFormatterPrompt(resource?: Uri): Promise<void> {
if (!(await inFormatterExtensionExperiment(this.serviceContainer))) {
if (!inFormatterExtensionExperiment(this.serviceContainer)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/providers/prompts/promptUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { isInsider } from '../../common/vscodeApis/extensionsApi';
import { getConfiguration, getWorkspaceFolder } from '../../common/vscodeApis/workspaceApis';
import { IServiceContainer } from '../../ioc/types';

export function inFormatterExtensionExperiment(serviceContainer: IServiceContainer): Promise<boolean> {
export function inFormatterExtensionExperiment(serviceContainer: IServiceContainer): boolean {
const experiment = serviceContainer.get<IExperimentService>(IExperimentService);
return experiment.inExperiment(ShowFormatterExtensionPrompt.experiment);
return experiment.inExperimentSync(ShowFormatterExtensionPrompt.experiment);
}

export function doNotShowPromptState(key: string, serviceContainer: IServiceContainer): IPersistentState<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/test/providers/prompt/installFormatterPrompt.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ suite('Formatter Extension prompt tests', () => {

setup(() => {
inFormatterExtensionExperimentStub = sinon.stub(promptUtils, 'inFormatterExtensionExperiment');
inFormatterExtensionExperimentStub.resolves(true);
inFormatterExtensionExperimentStub.returns(true);

doNotShowPromptStateStub = sinon.stub(promptUtils, 'doNotShowPromptState');
persistState = TypeMoq.Mock.ofType<IPersistentState<boolean>>();
Expand Down Expand Up @@ -61,7 +61,7 @@ suite('Formatter Extension prompt tests', () => {
});

test('Not in experiment', async () => {
inFormatterExtensionExperimentStub.resolves(false);
inFormatterExtensionExperimentStub.returns(false);

await prompt.showInstallFormatterPrompt();
assert.isTrue(doNotShowPromptStateStub.notCalled);
Expand Down

0 comments on commit db04ec6

Please sign in to comment.