11import { ConfigurationChangeEvent , Disposable , GlobalEnvironmentVariableCollection } from 'vscode' ;
2- import { DidChangeEnvironmentEventArgs } from '../../../ api' ;
3- import { ShellStartupActivationStrings } from '../../../ common/localize' ;
4- import { traceError , traceInfo } from '../../../ common/logging' ;
5- import { showErrorMessage , showInformationMessage } from '../../../ common/window.apis' ;
6- import { getWorkspaceFolder , getWorkspaceFolders , onDidChangeConfiguration } from '../../../ common/workspace.apis' ;
7- import { EnvironmentManagers } from '../../../ internal.api' ;
8- import { getAutoActivationType , setAutoActivationType } from '../utils ' ;
9- import { ShellEnvsProvider , ShellScriptEditState , ShellStartupScriptProvider } from './startupProvider ' ;
2+ import { DidChangeEnvironmentEventArgs } from '../../api' ;
3+ import { ShellStartupActivationStrings } from '../../common/localize' ;
4+ import { traceError , traceInfo } from '../../common/logging' ;
5+ import { showErrorMessage , showInformationMessage } from '../../common/window.apis' ;
6+ import { getWorkspaceFolder , getWorkspaceFolders , onDidChangeConfiguration } from '../../common/workspace.apis' ;
7+ import { EnvironmentManagers } from '../../internal.api' ;
8+ import { ShellEnvsProvider , ShellScriptEditState , ShellStartupScriptProvider } from './shells/startupProvider ' ;
9+ import { getAutoActivationType , setAutoActivationType } from './utils ' ;
1010
1111export interface ShellStartupActivationManager extends Disposable {
1212 initialize ( ) : Promise < void > ;
@@ -42,20 +42,12 @@ export class ShellStartupActivationManagerImpl implements ShellStartupActivation
4242 // remove any contributed environment variables
4343 const workspaces = getWorkspaceFolders ( ) ?? [ ] ;
4444 if ( workspaces . length > 0 ) {
45- // User has one or more workspaces open
46- const promises : Promise < void > [ ] = [ ] ;
4745 workspaces . forEach ( ( workspace ) => {
4846 const collection = this . envCollection . getScoped ( { workspaceFolder : workspace } ) ;
49- promises . push (
50- ...this . shellEnvsProviders . map ( ( provider ) => provider . removeEnvVariables ( collection ) ) ,
51- ) ;
47+ this . shellEnvsProviders . forEach ( ( provider ) => provider . removeEnvVariables ( collection ) ) ;
5248 } ) ;
53- await Promise . all ( promises ) ;
5449 } else {
55- // User has no workspaces open
56- await Promise . all (
57- this . shellEnvsProviders . map ( ( provider ) => provider . removeEnvVariables ( this . envCollection ) ) ,
58- ) ;
50+ this . shellEnvsProviders . forEach ( ( provider ) => provider . removeEnvVariables ( this . envCollection ) ) ;
5951 }
6052 }
6153 }
@@ -72,15 +64,13 @@ export class ShellStartupActivationManagerImpl implements ShellStartupActivation
7264 if ( wf ) {
7365 const envVars = this . envCollection . getScoped ( { workspaceFolder : wf } ) ;
7466 if ( envVars ) {
75- await Promise . all (
76- this . shellEnvsProviders . map ( async ( provider ) => {
77- if ( e . new ) {
78- await provider . updateEnvVariables ( envVars , e . new ) ;
79- } else {
80- await provider . removeEnvVariables ( envVars ) ;
81- }
82- } ) ,
83- ) ;
67+ this . shellEnvsProviders . forEach ( ( provider ) => {
68+ if ( e . new ) {
69+ provider . updateEnvVariables ( envVars , e . new ) ;
70+ } else {
71+ provider . removeEnvVariables ( envVars ) ;
72+ }
73+ } ) ;
8474 }
8575 }
8676 }
@@ -132,9 +122,9 @@ export class ShellStartupActivationManagerImpl implements ShellStartupActivation
132122 ...this . shellEnvsProviders . map ( async ( provider ) => {
133123 const env = await this . em . getEnvironment ( workspace . uri ) ;
134124 if ( env ) {
135- await provider . updateEnvVariables ( collection , env ) ;
125+ provider . updateEnvVariables ( collection , env ) ;
136126 } else {
137- await provider . removeEnvVariables ( collection ) ;
127+ provider . removeEnvVariables ( collection ) ;
138128 }
139129 } ) ,
140130 ) ;
@@ -145,9 +135,9 @@ export class ShellStartupActivationManagerImpl implements ShellStartupActivation
145135 this . shellEnvsProviders . map ( async ( provider ) => {
146136 const env = await this . em . getEnvironment ( undefined ) ;
147137 if ( env ) {
148- await provider . updateEnvVariables ( this . envCollection , env ) ;
138+ provider . updateEnvVariables ( this . envCollection , env ) ;
149139 } else {
150- await provider . removeEnvVariables ( this . envCollection ) ;
140+ provider . removeEnvVariables ( this . envCollection ) ;
151141 }
152142 } ) ,
153143 ) ;
0 commit comments