@@ -55,16 +55,11 @@ export class ConfigServiceImpl
55
55
] ,
56
56
} ;
57
57
private cliConfig : DefaultCliConfig | undefined ;
58
- /**
59
- * An array of errors occurred during the loading and mapping of the CLI configuration.
60
- * If empty, IDE2 neither noticed any problems nor received any errors from the services.
61
- * The purpose of this array is to store the messages of all errors that were caught during
62
- * the initialization. It's not sufficient to broadcast the messages when they are caught because,
63
- * at that time, no client might exist.
64
- */
65
- private _configErrors : string [ ] = [ ] ;
66
58
private ready = new Deferred < void > ( ) ;
67
- private readonly configChangeEmitter = new Emitter < ConfigState > ( ) ;
59
+ private readonly configChangeEmitter = new Emitter < {
60
+ oldState : ConfigState ;
61
+ newState : ConfigState ;
62
+ } > ( ) ;
68
63
69
64
onStart ( ) : void {
70
65
this . initConfig ( ) ;
@@ -86,6 +81,7 @@ export class ConfigServiceImpl
86
81
if ( Config . sameAs ( this . _configState . config , config ) ) {
87
82
return ;
88
83
}
84
+ const oldConfigState = deepClone ( this . _configState ) ;
89
85
let copyDefaultCliConfig : DefaultCliConfig | undefined = deepClone (
90
86
this . cliConfig
91
87
) ;
@@ -115,26 +111,25 @@ export class ConfigServiceImpl
115
111
try {
116
112
await this . validateCliConfig ( this . cliConfig ) ;
117
113
delete this . _configState . messages ;
118
- this . fireConfigChanged ( this . _configState ) ;
114
+ this . fireConfigChanged ( oldConfigState , this . _configState ) ;
119
115
} catch ( err ) {
120
116
if ( err instanceof InvalidConfigError ) {
121
117
this . _configState . messages = err . errors ;
122
- this . fireConfigChanged ( this . _configState ) ;
118
+ this . fireConfigChanged ( oldConfigState , this . _configState ) ;
123
119
} else {
124
120
throw err ;
125
121
}
126
122
}
127
123
}
128
124
129
- async configErrors ( ) : Promise < string [ ] > {
130
- return this . _configErrors ;
131
- }
132
-
133
125
get cliConfiguration ( ) : DefaultCliConfig | undefined {
134
126
return this . cliConfig ;
135
127
}
136
128
137
- get onConfigChange ( ) : Event < ConfigState > {
129
+ get onConfigChange ( ) : Event < {
130
+ oldState : ConfigState ;
131
+ newState : ConfigState ;
132
+ } > {
138
133
return this . configChangeEmitter . event ;
139
134
}
140
135
@@ -235,9 +230,12 @@ export class ConfigServiceImpl
235
230
} ;
236
231
}
237
232
238
- private fireConfigChanged ( configState : ConfigState ) : void {
239
- this . configChangeEmitter . fire ( configState ) ;
240
- this . notificationService . notifyConfigDidChange ( configState ) ;
233
+ private fireConfigChanged (
234
+ oldState : ConfigState ,
235
+ newState : ConfigState
236
+ ) : void {
237
+ this . configChangeEmitter . fire ( { oldState, newState } ) ;
238
+ this . notificationService . notifyConfigDidChange ( newState ) ;
241
239
}
242
240
243
241
private async validateCliConfig ( config : DefaultCliConfig ) : Promise < void > {
0 commit comments