Browse Source

More clean up and change IDs to not be camelCased.

Afshin Darian 7 years ago
parent
commit
e854275894

+ 5 - 5
packages/application-extension/src/index.ts

@@ -41,8 +41,8 @@ namespace CommandIDs {
 /**
  * The main extension.
  */
-const mainPlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/application-extension:mainPlugin',
+const main: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/application-extension:main',
   requires: [ICommandPalette],
   activate: (app: JupyterLab, palette: ICommandPalette) => {
     addCommands(app, palette);
@@ -117,8 +117,8 @@ const mainPlugin: JupyterLabPlugin<void> = {
 /**
  * The default layout restorer provider.
  */
-const layoutPlugin: JupyterLabPlugin<ILayoutRestorer> = {
-  id: '@jupyterlab/application-extension:layoutPlugin',
+const layout: JupyterLabPlugin<ILayoutRestorer> = {
+  id: '@jupyterlab/application-extension:layout',
   requires: [IStateDB],
   activate: (app: JupyterLab, state: IStateDB) => {
     const first = app.started;
@@ -195,6 +195,6 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [ mainPlugin, layoutPlugin ];
+const plugins: JupyterLabPlugin<any>[] = [main, layout];
 
 export default plugins;

+ 0 - 0
packages/apputils-extension/schema/jupyter.services.theme-manager.json → packages/apputils-extension/schema/themes.json


+ 22 - 32
packages/apputils-extension/src/index.ts

@@ -102,8 +102,8 @@ function newConnector(manager: ServiceManager): IDataConnector<ISettingRegistry.
 /**
  * A service providing an interface to the main menu.
  */
-const mainMenuPlugin: JupyterLabPlugin<IMainMenu> = {
-  id: '@jupyterlab/apputils-extension:mainMenuPlugin',
+const menu: JupyterLabPlugin<IMainMenu> = {
+  id: '@jupyterlab/apputils-extension:menu',
   provides: IMainMenu,
   activate: (app: JupyterLab): IMainMenu => {
     let menu = new MainMenu();
@@ -125,9 +125,9 @@ const mainMenuPlugin: JupyterLabPlugin<IMainMenu> = {
 /**
  * The default commmand palette extension.
  */
-const palettePlugin: JupyterLabPlugin<ICommandPalette> = {
+const palette: JupyterLabPlugin<ICommandPalette> = {
   activate: activatePalette,
-  id: '@jupyterlab/apputils-extension:palettePlugin',
+  id: '@jupyterlab/apputils-extension:palette',
   provides: ICommandPalette,
   requires: [ILayoutRestorer],
   autoStart: true
@@ -137,8 +137,8 @@ const palettePlugin: JupyterLabPlugin<ICommandPalette> = {
 /**
  * The default setting registry provider.
  */
-const settingPlugin: JupyterLabPlugin<ISettingRegistry> = {
-  id: '@jupyterlab/apputils-extension:settingPlugin',
+const settings: JupyterLabPlugin<ISettingRegistry> = {
+  id: '@jupyterlab/apputils-extension:settings',
   activate: (app: JupyterLab): ISettingRegistry => {
     return new SettingRegistry({ connector: newConnector(app.serviceManager) });
   },
@@ -147,26 +147,22 @@ const settingPlugin: JupyterLabPlugin<ISettingRegistry> = {
 };
 
 
-
 /**
  * The default theme manager provider.
  */
-const themePlugin: JupyterLabPlugin<IThemeManager> = {
-  id: '@jupyterlab/apputils-extension:themePlugin',
+const themes: JupyterLabPlugin<IThemeManager> = {
+  id: '@jupyterlab/apputils-extension:themes',
   requires: [ISettingRegistry, ISplashScreen],
   activate: (app: JupyterLab, settingRegistry: ISettingRegistry, splash: ISplashScreen): IThemeManager => {
-    let baseUrl = app.serviceManager.serverSettings.baseUrl;
-    let host = app.shell;
-    let when = app.started;
-    let manager = new ThemeManager({ baseUrl,  settingRegistry, host, when });
-    let disposable = splash.show();
-    manager.ready.then(() => {
-      setTimeout(() => {
-        disposable.dispose();
-      }, 2500);
-    }, () => {
-      disposable.dispose();
-    });
+    const baseUrl = app.serviceManager.serverSettings.baseUrl;
+    const host = app.shell;
+    const when = app.started;
+    const manager = new ThemeManager({ baseUrl, host, settingRegistry, when });
+    const disposable = splash.show();
+    const dispose = () => { disposable.dispose(); };
+
+    manager.ready.then(() => { setTimeout(dispose, 2500); }, dispose);
+
     return manager;
   },
   autoStart: true,
@@ -177,8 +173,8 @@ const themePlugin: JupyterLabPlugin<IThemeManager> = {
 /**
  * The default splash screen provider.
  */
-const splashPlugin: JupyterLabPlugin<ISplashScreen> = {
-  id: '@jupyterlab/apputils-extension:splashPlugin',
+const splash: JupyterLabPlugin<ISplashScreen> = {
+  id: '@jupyterlab/apputils-extension:splash',
   autoStart: true,
   provides: ISplashScreen,
   activate: () => {
@@ -191,12 +187,11 @@ const splashPlugin: JupyterLabPlugin<ISplashScreen> = {
 };
 
 
-
 /**
  * The default state database for storing application state.
  */
-const stateDBPlugin: JupyterLabPlugin<IStateDB> = {
-  id: '@jupyterlab/apputils-extension:stateDBPlugin',
+const state: JupyterLabPlugin<IStateDB> = {
+  id: '@jupyterlab/apputils-extension:state',
   autoStart: true,
   provides: IStateDB,
   activate: (app: JupyterLab) => {
@@ -229,12 +224,7 @@ const stateDBPlugin: JupyterLabPlugin<IStateDB> = {
  * Export the plugins as default.
  */
 const plugins: JupyterLabPlugin<any>[] = [
-  mainMenuPlugin,
-  palettePlugin,
-  settingPlugin,
-  stateDBPlugin,
-  splashPlugin,
-  themePlugin
+  menu, palette, settings, state, splash, themes
 ];
 export default plugins;
 

+ 0 - 0
packages/codemirror-extension/schema/jupyter.services.codemirror-commands.json → packages/codemirror-extension/schema/commands.json


+ 17 - 9
packages/codemirror-extension/src/index.ts

@@ -58,9 +58,8 @@ namespace CommandIDs {
 /**
  * The editor services.
  */
-export
-const servicesPlugin: JupyterLabPlugin<IEditorServices> = {
-  id: '@jupyterlab/codemirror-extension:servicesPlugin',
+const services: JupyterLabPlugin<IEditorServices> = {
+  id: '@jupyterlab/codemirror-extension:services',
   provides: IEditorServices,
   activate: (): IEditorServices => editorServices
 };
@@ -69,10 +68,15 @@ const servicesPlugin: JupyterLabPlugin<IEditorServices> = {
 /**
  * The editor commands.
  */
-export
-const commandsPlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/codemirror-extension:commandsPlugin',
-  requires: [IEditorTracker, IMainMenu, ICommandPalette, IStateDB, ISettingRegistry],
+const commands: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/codemirror-extension:commands',
+  requires: [
+    IEditorTracker,
+    IMainMenu,
+    ICommandPalette,
+    IStateDB,
+    ISettingRegistry
+  ],
   activate: activateEditorCommands,
   autoStart: true
 };
@@ -81,16 +85,20 @@ const commandsPlugin: JupyterLabPlugin<void> = {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [commandsPlugin, servicesPlugin];
+const plugins: JupyterLabPlugin<any>[] = [commands, services];
 export default plugins;
 
 
+/**
+ * The plugin ID used as the key in the setting registry.
+ */
+const id = commands.id;
+
 /**
  * Set up the editor widget menu and commands.
  */
 function activateEditorCommands(app: JupyterLab, tracker: IEditorTracker, mainMenu: IMainMenu, palette: ICommandPalette, state: IStateDB, settingRegistry: ISettingRegistry): void {
   const { commands, restored } = app;
-  const { id } = commandsPlugin;
   let { theme, keyMap } = CodeMirrorEditor.defaultConfig;
 
   /**

+ 8 - 10
packages/completer-extension/src/index.ts

@@ -48,10 +48,10 @@ namespace CommandIDs {
 
 
 /**
- * A service providing code completion for editors.
+ * A plugin providing code completion for editors.
  */
-const service: JupyterLabPlugin<ICompletionManager> = {
-  id: '@jupyterlab/completer-extension:service',
+const manager: JupyterLabPlugin<ICompletionManager> = {
+  id: '@jupyterlab/completer-extension:manager',
   autoStart: true,
   provides: ICompletionManager,
   activate: (app: JupyterLab): ICompletionManager => {
@@ -123,8 +123,8 @@ const service: JupyterLabPlugin<ICompletionManager> = {
 /**
  * An extension that registers consoles for code completion.
  */
-const consolePlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/completer-extension:consolePlugin',
+const consoles: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/completer-extension:consoles',
   requires: [ICompletionManager, IConsoleTracker],
   autoStart: true,
   activate: (app: JupyterLab, manager: ICompletionManager, consoles: IConsoleTracker): void => {
@@ -177,8 +177,8 @@ const consolePlugin: JupyterLabPlugin<void> = {
 /**
  * An extension that registers notebooks for code completion.
  */
-const notebookPlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/completer-extension:notebookPlugin',
+const notebooks: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/completer-extension:notebooks',
   requires: [ICompletionManager, INotebookTracker],
   autoStart: true,
   activate: (app: JupyterLab, manager: ICompletionManager, notebooks: INotebookTracker): void => {
@@ -229,7 +229,5 @@ const notebookPlugin: JupyterLabPlugin<void> = {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [
-  service, consolePlugin, notebookPlugin
-];
+const plugins: JupyterLabPlugin<any>[] = [manager, consoles, notebooks];
 export default plugins;

+ 5 - 7
packages/console-extension/src/index.ts

@@ -80,9 +80,8 @@ namespace CommandIDs {
 /**
  * The console widget tracker provider.
  */
-export
-const trackerPlugin: JupyterLabPlugin<IConsoleTracker> = {
-  id: '@jupyterlab/console-extension:trackerPlugin',
+const tracker: JupyterLabPlugin<IConsoleTracker> = {
+  id: '@jupyterlab/console-extension:tracker',
   provides: IConsoleTracker,
   requires: [
     IMainMenu,
@@ -100,9 +99,8 @@ const trackerPlugin: JupyterLabPlugin<IConsoleTracker> = {
 /**
  * The console widget content factory.
  */
-export
-const contentFactoryPlugin: JupyterLabPlugin<ConsolePanel.IContentFactory> = {
-  id: '@jupyterlab/console-extension:contentFactoryPlugin',
+const factory: JupyterLabPlugin<ConsolePanel.IContentFactory> = {
+  id: '@jupyterlab/console-extension:factory',
   provides: ConsolePanel.IContentFactory,
   requires: [IEditorServices],
   autoStart: true,
@@ -117,7 +115,7 @@ const contentFactoryPlugin: JupyterLabPlugin<ConsolePanel.IContentFactory> = {
 /**
  * Export the plugins as the default.
  */
-const plugins: JupyterLabPlugin<any>[] = [contentFactoryPlugin, trackerPlugin];
+const plugins: JupyterLabPlugin<any>[] = [factory, tracker];
 export default plugins;
 
 

+ 15 - 17
packages/filebrowser-extension/src/index.ts

@@ -90,9 +90,9 @@ namespace CommandIDs {
 /**
  * The default file browser extension.
  */
-const fileBrowserPlugin: JupyterLabPlugin<void> = {
-  activate: activateFileBrowser,
-  id: '@jupyterlab/filebrowser-extension:fileBrowserPlugin',
+const browser: JupyterLabPlugin<void> = {
+  activate: activateBrowser,
+  id: '@jupyterlab/filebrowser-extension:browser',
   requires: [
     IFileBrowserFactory,
     IDocumentManager,
@@ -105,9 +105,9 @@ const fileBrowserPlugin: JupyterLabPlugin<void> = {
 /**
  * The default file browser factory provider.
  */
-const factoryPlugin: JupyterLabPlugin<IFileBrowserFactory> = {
+const factory: JupyterLabPlugin<IFileBrowserFactory> = {
   activate: activateFactory,
-  id: '@jupyterlab/filebrowser-extension:factoryPlugin',
+  id: '@jupyterlab/filebrowser-extension:factory',
   provides: IFileBrowserFactory,
   requires: [IDocumentManager, IStateDB],
   autoStart: true
@@ -116,12 +116,10 @@ const factoryPlugin: JupyterLabPlugin<IFileBrowserFactory> = {
 /**
  * The default file browser menu extension.
  */
-const fileBrowserMenuPlugin: JupyterLabPlugin<void> = {
-  activate: activateFileBrowserMenu,
+const menu: JupyterLabPlugin<void> = {
+  activate: activateMenu,
   id: 'jupyter.extensions.filebrowsermenu',
-  requires: [
-    IMainMenu,
-  ],
+  requires: [IMainMenu],
   autoStart: true
 };
 
@@ -130,11 +128,10 @@ const fileBrowserMenuPlugin: JupyterLabPlugin<void> = {
  */
 const namespace = 'filebrowser';
 
-
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [factoryPlugin, fileBrowserPlugin, fileBrowserMenuPlugin];
+const plugins: JupyterLabPlugin<any>[] = [factory, browser, menu];
 export default plugins;
 
 
@@ -144,8 +141,7 @@ export default plugins;
 function activateFactory(app: JupyterLab, docManager: IDocumentManager, state: IStateDB): IFileBrowserFactory {
   const { commands } = app;
   const tracker = new InstanceTracker<FileBrowser>({ namespace });
-
-  const createFileBrowser = (id: string, options: IFileBrowserFactory.IOptions = {}) => {
+  const createFileBrowser = (id: string, options: IFileBrowserFactory.IOptions = { }) => {
     const model = new FileBrowserModel({
       manager: docManager,
       driveName: options.driveName || '',
@@ -180,14 +176,16 @@ function activateFactory(app: JupyterLab, docManager: IDocumentManager, state: I
 
     return widget;
   };
-  let defaultBrowser = createFileBrowser('filebrowser');
+  const defaultBrowser = createFileBrowser('filebrowser');
+
   return { createFileBrowser, defaultBrowser, tracker };
 }
 
+
 /**
  * Activate the default file browser in the sidebar.
  */
-function activateFileBrowser(app: JupyterLab, factory: IFileBrowserFactory, docManager: IDocumentManager, palette: ICommandPalette, restorer: ILayoutRestorer): void {
+function activateBrowser(app: JupyterLab, factory: IFileBrowserFactory, docManager: IDocumentManager, mainMenu: IMainMenu, palette: ICommandPalette, restorer: ILayoutRestorer): void {
   const fbWidget = factory.defaultBrowser;
 
   // Let the application restorer track the primary file browser (that is
@@ -228,7 +226,7 @@ function activateFileBrowser(app: JupyterLab, factory: IFileBrowserFactory, docM
 /**
  * Activate the default file browser menu in the main menu.
  */
-function activateFileBrowserMenu(app: JupyterLab, mainMenu: IMainMenu): void {
+function activateMenu(app: JupyterLab, mainMenu: IMainMenu): void {
   let menu = createMenu(app);
 
   mainMenu.addMenu(menu, { rank: 1 });

+ 0 - 0
packages/fileeditor-extension/schema/jupyter.services.editor-tracker.json → packages/fileeditor-extension/schema/plugin.json


+ 1 - 5
packages/fileeditor-extension/src/index.ts

@@ -77,11 +77,7 @@ namespace CommandIDs {
 const plugin: JupyterLabPlugin<IEditorTracker> = {
   activate,
   id: '@jupyterlab/fileeditor-extension:plugin',
-  requires: [
-    ILayoutRestorer,
-    IEditorServices,
-    ISettingRegistry
-  ],
+  requires: [ILayoutRestorer, IEditorServices, ISettingRegistry],
   optional: [ILauncher],
   provides: IEditorTracker,
   autoStart: true

+ 7 - 9
packages/inspector-extension/src/index.ts

@@ -38,8 +38,8 @@ namespace CommandIDs {
 /**
  * A service providing code introspection.
  */
-const corePlugin: JupyterLabPlugin<IInspector> = {
-  id: '@jupyterlab/inspector-extension:corePlugin',
+const inspector: JupyterLabPlugin<IInspector> = {
+  id: '@jupyterlab/inspector-extension:inspector',
   requires: [ICommandPalette, ILayoutRestorer],
   provides: IInspector,
   autoStart: true,
@@ -105,8 +105,8 @@ const corePlugin: JupyterLabPlugin<IInspector> = {
 /**
  * An extension that registers consoles for inspection.
  */
-const consolePlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/inspector-extension:consolePlugin',
+const consoles: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/inspector-extension:consoles',
   requires: [IInspector, IConsoleTracker],
   autoStart: true,
   activate: (app: JupyterLab, manager: IInspector, consoles: IConsoleTracker): void => {
@@ -157,8 +157,8 @@ const consolePlugin: JupyterLabPlugin<void> = {
 /**
  * An extension that registers notebooks for inspection.
  */
-const notebookPlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/inspector-extension:notebookPlugin',
+const notebooks: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/inspector-extension:notebooks',
   requires: [IInspector, INotebookTracker],
   autoStart: true,
   activate: (app: JupyterLab, manager: IInspector, notebooks: INotebookTracker): void => {
@@ -209,9 +209,7 @@ const notebookPlugin: JupyterLabPlugin<void> = {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [
-  corePlugin, consolePlugin, notebookPlugin
-];
+const plugins: JupyterLabPlugin<any>[] = [inspector, consoles, notebooks];
 export default plugins;
 
 

+ 7 - 9
packages/notebook-extension/src/index.ts

@@ -237,9 +237,8 @@ const EXPORT_TO_FORMATS = [
 /**
  * The notebook widget tracker provider.
  */
-export
-const trackerPlugin: JupyterLabPlugin<INotebookTracker> = {
-  id: '@jupyterlab/notebook-extension:trackerPlugin',
+const tracker: JupyterLabPlugin<INotebookTracker> = {
+  id: '@jupyterlab/notebook-extension:tracker',
   provides: INotebookTracker,
   requires: [
     IMainMenu,
@@ -257,9 +256,8 @@ const trackerPlugin: JupyterLabPlugin<INotebookTracker> = {
 /**
  * The notebook cell factory provider.
  */
-export
-const contentFactoryPlugin: JupyterLabPlugin<NotebookPanel.IContentFactory> = {
-  id: '@jupyterlab/notebook-extension:contentFactoryPlugin',
+const factory: JupyterLabPlugin<NotebookPanel.IContentFactory> = {
+  id: '@jupyterlab/notebook-extension:factory',
   provides: NotebookPanel.IContentFactory,
   requires: [IEditorServices],
   autoStart: true,
@@ -273,10 +271,10 @@ const contentFactoryPlugin: JupyterLabPlugin<NotebookPanel.IContentFactory> = {
 /**
  * The cell tools extension.
  */
-const cellToolsPlugin: JupyterLabPlugin<ICellTools> = {
+const tools: JupyterLabPlugin<ICellTools> = {
   activate: activateCellTools,
   provides: ICellTools,
-  id: '@jupyterlab/notebook-extension:cellToolsPlugin',
+  id: '@jupyterlab/notebook-extension:tools',
   autoStart: true,
   requires: [INotebookTracker, IEditorServices, IStateDB]
 };
@@ -285,7 +283,7 @@ const cellToolsPlugin: JupyterLabPlugin<ICellTools> = {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [contentFactoryPlugin, trackerPlugin, cellToolsPlugin];
+const plugins: JupyterLabPlugin<any>[] = [factory, tracker, tools];
 export default plugins;
 
 

+ 0 - 0
packages/shortcuts-extension/schema/jupyter.extensions.shortcuts.json → packages/shortcuts-extension/schema/plugin.json


+ 1 - 1
packages/shortcuts-extension/src/index.ts

@@ -29,7 +29,7 @@ import {
  * shortcut are preset in the settings schema file of this extension.
  * Additionally, each shortcut can be individually set by the end user by
  * modifying its setting (either in the text editor or by modifying its
- * underlying JSON file).
+ * underlying JSON schema file).
  *
  * When setting shortcut selectors, there are two concepts to consider:
  * specificity and matchability. These two interact in sometimes

+ 8 - 10
packages/tooltip-extension/src/index.ts

@@ -55,10 +55,10 @@ namespace CommandIDs {
 
 
 /**
- * The main tooltip service.
+ * The main tooltip manager plugin.
  */
-const service: JupyterLabPlugin<ITooltipManager> = {
-  id: '@jupyterlab/tooltip-extension:service',
+const manager: JupyterLabPlugin<ITooltipManager> = {
+  id: '@jupyterlab/tooltip-extension:manager',
   autoStart: true,
   provides: ITooltipManager,
   activate: (app: JupyterLab): ITooltipManager => {
@@ -97,8 +97,8 @@ const service: JupyterLabPlugin<ITooltipManager> = {
 /**
  * The console tooltip plugin.
  */
-const consolePlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/tooltip-extension:consolePlugin',
+const consoles: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/tooltip-extension:consoles',
   autoStart: true,
   requires: [ITooltipManager, IConsoleTracker],
   activate: (app: JupyterLab, manager: ITooltipManager, consoles: IConsoleTracker): void => {
@@ -130,8 +130,8 @@ const consolePlugin: JupyterLabPlugin<void> = {
 /**
  * The notebook tooltip plugin.
  */
-const notebookPlugin: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/tooltip-extension:notebookPlugin',
+const notebooks: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/tooltip-extension:notebooks',
   autoStart: true,
   requires: [ITooltipManager, INotebookTracker],
   activate: (app: JupyterLab, manager: ITooltipManager, notebooks: INotebookTracker): void => {
@@ -162,9 +162,7 @@ const notebookPlugin: JupyterLabPlugin<void> = {
 /**
  * Export the plugins as default.
  */
-const plugins: JupyterLabPlugin<any>[] = [
-  service, consolePlugin, notebookPlugin
-];
+const plugins: JupyterLabPlugin<any>[] = [manager, consoles, notebooks];
 export default plugins;