Skip to content

Commit

Permalink
move context creation to contstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Huff authored and Ian Huff committed Sep 22, 2022
1 parent 4a8df3f commit f5692da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/notebooks/controllers/controllerLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export class ControllerLoader implements IControllerLoader, IExtensionSyncActiva
@inject(IInterpreterService) private readonly interpreters: IInterpreterService,
@inject(IControllerRegistration) private readonly registration: IControllerRegistration,
@inject(ICommandManager) private readonly commandManager: ICommandManager
) {}
) {
// This context key is set to true when controllers have completed their intitial load or are done loading after a refresh
// It's set to false on activation and when a refresh is requested.
this.controllersLoadedContext = new ContextKey('jupyter.controllersLoaded', this.commandManager);
}

public activate(): void {
// Make sure to reload whenever we do something that changes state
Expand All @@ -61,9 +65,6 @@ export class ControllerLoader implements IControllerLoader, IExtensionSyncActiva

this.loadControllers(true).ignoreErrors();

// This context key is set to true when controllers have completed their intitial load or are done loading after a refresh
// It's set to false on activation and when a refresh is requested.
this.controllersLoadedContext = new ContextKey('jupyter.controllersLoaded', this.commandManager);
this.controllersLoadedContext.set(false).then(noop, noop);
}
public loadControllers(refresh?: boolean | undefined): Promise<void> {
Expand Down

0 comments on commit f5692da

Please sign in to comment.