|
1 | 1 | import { ConfigurationChangeEvent, Disposable, GlobalEnvironmentVariableCollection } from 'vscode'; |
2 | 2 | import { getWorkspaceFolder, getWorkspaceFolders, onDidChangeConfiguration } from '../../../common/workspace.apis'; |
3 | 3 | import { getAutoActivationType, setAutoActivationType } from '../utils'; |
4 | | -import { ShellScriptEditState, ShellSetupState, ShellStartupProvider } from './startupProvider'; |
| 4 | +import { ShellScriptEditState, ShellStartupProvider } from './startupProvider'; |
5 | 5 | import { DidChangeEnvironmentEventArgs } from '../../../api'; |
6 | 6 | import { EnvironmentManagers } from '../../../internal.api'; |
7 | 7 | import { traceError, traceInfo } from '../../../common/logging'; |
@@ -85,18 +85,26 @@ export class ShellStartupActivationManagerImpl implements ShellStartupActivation |
85 | 85 | } |
86 | 86 | } |
87 | 87 |
|
88 | | - private async isSetupRequired(): Promise<boolean> { |
89 | | - const results = await Promise.all(this.shellStartupProviders.map((provider) => provider.isSetup())); |
90 | | - return results |
91 | | - .filter((r) => r !== ShellSetupState.NotInstalled) |
92 | | - .some((result) => result === ShellSetupState.NotSetup); |
| 88 | + private async getSetupRequired(): Promise<ShellStartupProvider[]> { |
| 89 | + const providers: ShellStartupProvider[] = []; |
| 90 | + |
| 91 | + await Promise.all( |
| 92 | + this.shellStartupProviders.map(async (provider) => { |
| 93 | + if (await provider.isSetup()) { |
| 94 | + providers.push(provider); |
| 95 | + } |
| 96 | + }), |
| 97 | + ); |
| 98 | + |
| 99 | + return providers; |
93 | 100 | } |
94 | 101 |
|
95 | 102 | public async initialize(): Promise<void> { |
96 | 103 | const autoActType = getAutoActivationType(); |
97 | 104 | if (autoActType === 'shellStartup') { |
98 | | - if (await this.isSetupRequired()) { |
99 | | - const shells = this.shellStartupProviders.map((provider) => provider.name).join(', '); |
| 105 | + const providers = await this.getSetupRequired(); |
| 106 | + if (providers.length > 0) { |
| 107 | + const shells = providers.map((provider) => provider.name).join(', '); |
100 | 108 | const result = await showInformationMessage( |
101 | 109 | ShellStartupActivationStrings.shellStartupScriptEditPrompt, |
102 | 110 | { modal: true, detail: `${ShellStartupActivationStrings.updatingTheseProfiles}: ${shells}` }, |
|
0 commit comments