Parcourir la source

Simplify activate() function, do not compete with file browser in case of a brand new session. (Both extensions were checking whether the layout is fresh and attempting to take over the left area.)

Afshin Darian il y a 6 ans
Parent
commit
e2c31138f9
1 fichiers modifiés avec 4 ajouts et 18 suppressions
  1. 4 18
      packages/extensionmanager-extension/src/index.ts

+ 4 - 18
packages/extensionmanager-extension/src/index.ts

@@ -14,11 +14,6 @@ import {
 } from '@jupyterlab/extensionmanager';
 
 
-/**
- * The extensionmanager-view namespace token.
- */
-const namespace = 'extensionmanagerview';
-
 /**
  * IDs of the commands added by this extension.
  */
@@ -52,22 +47,13 @@ const plugin: JupyterLabPlugin<void> = {
       return;
     }
 
-    const { commands, shell, serviceManager} = app;
+    const { shell, serviceManager} = app;
     const view = new ExtensionView(serviceManager);
 
     view.id = 'extensionmanager.main-view';
-    restorer.add(view, namespace);
     view.title.label = 'Extensions';
+    restorer.add(view, view.id);
     shell.addToLeftArea(view);
-
-
-    // If the layout is a fresh session without saved data, open file view.
-    app.restored.then(layout => {
-      if (layout.fresh) {
-        commands.execute(CommandIDs.showExtensionManager, undefined);
-      }
-    });
-
     addCommands(app, view);
   }
 };
@@ -95,9 +81,9 @@ function addCommands(app: JupyterLab, view: ExtensionView): void {
   commands.addCommand(CommandIDs.toggleExtensionManager, {
     execute: () => {
       if (view.isHidden) {
-        return commands.execute(CommandIDs.showExtensionManager, void 0);
+        return commands.execute(CommandIDs.showExtensionManager, undefined);
       } else {
-        return commands.execute(CommandIDs.hideExtensionManager, void 0);
+        return commands.execute(CommandIDs.hideExtensionManager, undefined);
       }
     }
   });