Skip to content

Commit 54b6ced

Browse files
debug: fix restoration of selected configuration (#10287)
The debug view has the functionality to save the currently selected debug configuration to local storage. However the restoring of it failed as the initialization of the debug configuration manager was not completed by the time the restore action was attempted. The `initialized` field was assigned after some asynchronous operation which meant it was `undefined` when other logic tried to use it. This change fixes the intended wait for initialization of the debug configuration manger. Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com> Co-authored-by: Paul Marechal <paul.marechal@ericsson.com>
1 parent 541304a commit 54b6ced

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/debug/src/browser/debug-configuration-manager.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ export class DebugConfigurationManager {
8282
protected debugConfigurationTypeKey: ContextKey<string>;
8383

8484
protected initialized: Promise<void>;
85+
8586
@postConstruct()
8687
protected async init(): Promise<void> {
8788
this.debugConfigurationTypeKey = this.contextKeyService.createKey<string>('debugConfigurationType', undefined);
88-
await this.preferences.ready;
89-
this.initialized = this.updateModels();
90-
this.preferences.onPreferenceChanged(e => {
91-
if (e.preferenceName === 'launch') {
92-
this.updateModels();
93-
}
89+
this.initialized = this.preferences.ready.then(() => {
90+
this.preferences.onPreferenceChanged(e => {
91+
if (e.preferenceName === 'launch') {
92+
this.updateModels();
93+
}
94+
});
95+
return this.updateModels();
9496
});
9597
}
9698

0 commit comments

Comments
 (0)