Skip to content

Commit 5ffb3f8

Browse files
committed
Ensure installs are checked first.
1 parent bacc31b commit 5ffb3f8

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

src/client/providers/prompts/installFormatterPrompt.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,7 @@ export class InstallFormatterPrompt implements IInstallFormatterPrompt {
5050

5151
let selection: string | undefined;
5252

53-
if (formatter === 'black' && !black) {
54-
this.shownThisSession = true;
55-
selection = await showInformationMessage(
56-
ToolsExtensions.installBlackFormatterPrompt,
57-
'Black',
58-
'Autopep8',
59-
Common.doNotShowAgain,
60-
);
61-
} else if (formatter === 'autopep8' && !autopep8) {
62-
this.shownThisSession = true;
63-
selection = await showInformationMessage(
64-
ToolsExtensions.installAutopep8FormatterPrompt,
65-
'Black',
66-
'Autopep8',
67-
Common.doNotShowAgain,
68-
);
69-
} else if (black || autopep8) {
53+
if (black || autopep8) {
7054
this.shownThisSession = true;
7155
if (black && autopep8) {
7256
selection = await showInformationMessage(
@@ -94,6 +78,22 @@ export class InstallFormatterPrompt implements IInstallFormatterPrompt {
9478
selection = 'Autopep8';
9579
}
9680
}
81+
} else if (formatter === 'black' && !black) {
82+
this.shownThisSession = true;
83+
selection = await showInformationMessage(
84+
ToolsExtensions.installBlackFormatterPrompt,
85+
'Black',
86+
'Autopep8',
87+
Common.doNotShowAgain,
88+
);
89+
} else if (formatter === 'autopep8' && !autopep8) {
90+
this.shownThisSession = true;
91+
selection = await showInformationMessage(
92+
ToolsExtensions.installAutopep8FormatterPrompt,
93+
'Black',
94+
'Autopep8',
95+
Common.doNotShowAgain,
96+
);
9797
}
9898

9999
if (selection === 'Black') {

src/client/providers/prompts/promptUtils.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ConfigurationTarget, Uri } from 'vscode';
55
import { ShowFormatterExtensionPrompt } from '../../common/experiments/groups';
66
import { IExperimentService, IPersistentState, IPersistentStateFactory } from '../../common/types';
77
import { executeCommand } from '../../common/vscodeApis/commandApis';
8-
import { isInsider, getExtension } from '../../common/vscodeApis/extensionsApi';
8+
import { isInsider } from '../../common/vscodeApis/extensionsApi';
99
import { getConfiguration, getWorkspaceFolder } from '../../common/vscodeApis/workspaceApis';
1010
import { IServiceContainer } from '../../ioc/types';
1111

@@ -34,11 +34,5 @@ export async function installFormatterExtension(extensionId: string, resource?:
3434
installPreReleaseVersion: isInsider(),
3535
});
3636

37-
const extension = getExtension(extensionId);
38-
if (!extension) {
39-
return;
40-
}
41-
42-
await extension.activate();
4337
await updateDefaultFormatter(extensionId, resource);
4438
}

0 commit comments

Comments
 (0)