Преглед изворни кода

prettier-ify the files we changed extensively

Jason Grout пре 6 година
родитељ
комит
d48a093553

+ 67 - 103
packages/cells/src/model.ts

@@ -3,40 +3,29 @@
 | Distributed under the terms of the Modified BSD License.
 |----------------------------------------------------------------------------*/
 
-import {
-  JSONExt, JSONValue
-} from '@phosphor/coreutils';
+import { JSONExt, JSONValue } from '@phosphor/coreutils';
 
-import {
-  ISignal, Signal
-} from '@phosphor/signaling';
+import { ISignal, Signal } from '@phosphor/signaling';
 
-import {
-  IAttachmentsModel, AttachmentsModel
-} from '@jupyterlab/attachments';
+import { IAttachmentsModel, AttachmentsModel } from '@jupyterlab/attachments';
 
-import {
-  CodeEditor
-} from '@jupyterlab/codeeditor';
+import { CodeEditor } from '@jupyterlab/codeeditor';
 
-import {
-  IChangedArgs, nbformat, uuid
-} from '@jupyterlab/coreutils';
+import { IChangedArgs, nbformat, uuid } from '@jupyterlab/coreutils';
 
 import {
-  IObservableJSON, IModelDB, IObservableValue, ObservableValue
+  IObservableJSON,
+  IModelDB,
+  IObservableValue,
+  ObservableValue
 } from '@jupyterlab/observables';
 
-import {
-  IOutputAreaModel, OutputAreaModel
-} from '@jupyterlab/outputarea';
-
+import { IOutputAreaModel, OutputAreaModel } from '@jupyterlab/outputarea';
 
 /**
  * The definition of a model object for a cell.
  */
-export
-interface ICellModel extends CodeEditor.IModel {
+export interface ICellModel extends CodeEditor.IModel {
   /**
    * The type of the cell.
    */
@@ -76,20 +65,17 @@ interface ICellModel extends CodeEditor.IModel {
 /**
  * The definition of a model cell object for a cell with attachments.
  */
-export
-interface IAttachmentsCellModel extends ICellModel {
+export interface IAttachmentsCellModel extends ICellModel {
   /**
    * The cell attachments
    */
   readonly attachments: IAttachmentsModel;
 }
 
-
 /**
  * The definition of a code cell.
  */
-export
-interface ICodeCellModel extends ICellModel {
+export interface ICodeCellModel extends ICellModel {
   /**
    * The type of the cell.
    *
@@ -114,12 +100,10 @@ interface ICodeCellModel extends ICellModel {
   readonly outputs: IOutputAreaModel;
 }
 
-
 /**
  * The definition of a markdown cell.
  */
-export
-interface IMarkdownCellModel extends IAttachmentsCellModel {
+export interface IMarkdownCellModel extends IAttachmentsCellModel {
   /**
    * The type of the cell.
    */
@@ -129,14 +113,12 @@ interface IMarkdownCellModel extends IAttachmentsCellModel {
    * Serialize the model to JSON.
    */
   toJSON(): nbformat.IMarkdownCell;
- }
-
+}
 
 /**
  * The definition of a raw cell.
  */
-export
-interface IRawCellModel extends IAttachmentsCellModel {
+export interface IRawCellModel extends IAttachmentsCellModel {
   /**
    * The type of the cell.
    */
@@ -148,35 +130,29 @@ interface IRawCellModel extends IAttachmentsCellModel {
   toJSON(): nbformat.IRawCell;
 }
 
-
-export
-function isCodeCellModel(model: ICellModel): model is ICodeCellModel {
+export function isCodeCellModel(model: ICellModel): model is ICodeCellModel {
   return model.type === 'code';
 }
 
-
-export
-function isMarkdownCellModel(model: ICellModel): model is IMarkdownCellModel {
+export function isMarkdownCellModel(
+  model: ICellModel
+): model is IMarkdownCellModel {
   return model.type === 'markdown';
 }
 
-
-export
-function isRawCellModel(model: ICellModel): model is IRawCellModel {
+export function isRawCellModel(model: ICellModel): model is IRawCellModel {
   return model.type === 'raw';
 }
 
-
 /**
  * An implementation of the cell model.
  */
-export
-class CellModel extends CodeEditor.Model implements ICellModel {
+export class CellModel extends CodeEditor.Model implements ICellModel {
   /**
    * Construct a cell model from optional cell content.
    */
   constructor(options: CellModel.IOptions) {
-    super({modelDB: options.modelDB});
+    super({ modelDB: options.modelDB });
 
     this.id = options.id || uuid();
 
@@ -278,7 +254,7 @@ class CellModel extends CodeEditor.Model implements ICellModel {
     return {
       cell_type: this.type,
       source: this.value.text,
-      metadata,
+      metadata
     } as nbformat.ICell;
   }
 
@@ -287,7 +263,12 @@ class CellModel extends CodeEditor.Model implements ICellModel {
    *
    * The default implementation is a no-op.
    */
-  onTrustedChanged(trusted: IObservableValue, args: ObservableValue.IChangedArgs): void { /* no-op */ }
+  onTrustedChanged(
+    trusted: IObservableValue,
+    args: ObservableValue.IChangedArgs
+  ): void {
+    /* no-op */
+  }
 
   /**
    * Handle a change to the observable value.
@@ -297,12 +278,10 @@ class CellModel extends CodeEditor.Model implements ICellModel {
   }
 }
 
-
 /**
  * The namespace for `CellModel` statics.
  */
-export
-namespace CellModel {
+export namespace CellModel {
   /**
    * The options used to initialize a `CellModel`.
    */
@@ -324,25 +303,22 @@ namespace CellModel {
   }
 }
 
-
 /**
  * A base implementation for cell models with attachments.
  */
-export
-class AttachmentsCellModel extends CellModel {
-
+export class AttachmentsCellModel extends CellModel {
   /**
    * Construct a new cell with optional attachments.
    */
   constructor(options: AttachmentsCellModel.IOptions) {
     super(options);
-    let factory = (options.contentFactory ||
-      AttachmentsCellModel.defaultContentFactory
-    );
+    let factory =
+      options.contentFactory || AttachmentsCellModel.defaultContentFactory;
     let attachments: nbformat.IAttachments | undefined;
     let cell = options.cell;
     if (cell && (cell.cell_type === 'raw' || cell.cell_type === 'markdown')) {
-      attachments = (cell as (nbformat.IRawCell | nbformat.IMarkdownCell)).attachments;
+      attachments = (cell as nbformat.IRawCell | nbformat.IMarkdownCell)
+        .attachments;
     }
 
     this._attachments = factory.createAttachmentsModel({
@@ -363,7 +339,7 @@ class AttachmentsCellModel extends CellModel {
    * Serialize the model to JSON.
    */
   toJSON(): nbformat.IRawCell | nbformat.IMarkdownCell {
-    let cell = super.toJSON() as (nbformat.IRawCell | nbformat.IMarkdownCell);
+    let cell = super.toJSON() as nbformat.IRawCell | nbformat.IMarkdownCell;
     if (this.attachments.length) {
       cell.attachments = this.attachments.toJSON();
     }
@@ -371,20 +347,16 @@ class AttachmentsCellModel extends CellModel {
   }
 
   private _attachments: IAttachmentsModel | null = null;
-
 }
 
-
 /**
  * The namespace for `AttachmentsCellModel` statics.
  */
-export
-namespace AttachmentsCellModel {
+export namespace AttachmentsCellModel {
   /**
    * The options used to initialize a `AttachmentsCellModel`.
    */
-  export
-  interface IOptions extends CellModel.IOptions {
+  export interface IOptions extends CellModel.IOptions {
     /**
      * The factory for attachment model creation.
      */
@@ -394,23 +366,25 @@ namespace AttachmentsCellModel {
   /**
    * A factory for creating code cell model content.
    */
-  export
-  interface IContentFactory {
+  export interface IContentFactory {
     /**
      * Create an output area.
      */
-    createAttachmentsModel(options: IAttachmentsModel.IOptions): IAttachmentsModel;
+    createAttachmentsModel(
+      options: IAttachmentsModel.IOptions
+    ): IAttachmentsModel;
   }
 
   /**
    * The default implementation of an `IContentFactory`.
    */
-  export
-  class ContentFactory implements IContentFactory {
+  export class ContentFactory implements IContentFactory {
     /**
      * Create an attachments model.
      */
-    createAttachmentsModel(options: IAttachmentsModel.IOptions): IAttachmentsModel {
+    createAttachmentsModel(
+      options: IAttachmentsModel.IOptions
+    ): IAttachmentsModel {
       return new AttachmentsModel(options);
     }
   }
@@ -418,16 +392,13 @@ namespace AttachmentsCellModel {
   /**
    * The shared `ContentFactory` instance.
    */
-  export
-  const defaultContentFactory = new ContentFactory();
+  export const defaultContentFactory = new ContentFactory();
 }
 
-
 /**
  * An implementation of a raw cell model.
  */
-export
-class RawCellModel extends AttachmentsCellModel {
+export class RawCellModel extends AttachmentsCellModel {
   /**
    * The type of the cell.
    */
@@ -441,15 +412,12 @@ class RawCellModel extends AttachmentsCellModel {
   toJSON(): nbformat.IRawCell {
     return super.toJSON() as nbformat.IRawCell;
   }
-
 }
 
-
 /**
  * An implementation of a markdown cell model.
  */
-export
-class MarkdownCellModel extends AttachmentsCellModel {
+export class MarkdownCellModel extends AttachmentsCellModel {
   /**
    * Construct a markdown cell model from optional cell content.
    */
@@ -474,20 +442,16 @@ class MarkdownCellModel extends AttachmentsCellModel {
   }
 }
 
-
 /**
  * An implementation of a code cell Model.
  */
-export
-class CodeCellModel extends CellModel implements ICodeCellModel {
+export class CodeCellModel extends CellModel implements ICodeCellModel {
   /**
    * Construct a new code cell with optional original cell content.
    */
   constructor(options: CodeCellModel.IOptions) {
     super(options);
-    let factory = (options.contentFactory ||
-      CodeCellModel.defaultContentFactory
-    );
+    let factory = options.contentFactory || CodeCellModel.defaultContentFactory;
     let trusted = this.trusted;
     let cell = options.cell as nbformat.ICodeCell;
     let outputs: nbformat.IOutput[] = [];
@@ -563,7 +527,10 @@ class CodeCellModel extends CellModel implements ICodeCellModel {
   /**
    * Handle a change to the trusted state.
    */
-  onTrustedChanged(trusted: IObservableValue, args: ObservableValue.IChangedArgs): void {
+  onTrustedChanged(
+    trusted: IObservableValue,
+    args: ObservableValue.IChangedArgs
+  ): void {
     if (this._outputs) {
       this._outputs.trusted = args.newValue as boolean;
     }
@@ -577,29 +544,29 @@ class CodeCellModel extends CellModel implements ICodeCellModel {
   /**
    * Handle a change to the execution count.
    */
-  private _onExecutionCountChanged(count: IObservableValue, args: ObservableValue.IChangedArgs): void {
+  private _onExecutionCountChanged(
+    count: IObservableValue,
+    args: ObservableValue.IChangedArgs
+  ): void {
     this.contentChanged.emit(void 0);
     this.stateChanged.emit({
       name: 'executionCount',
       oldValue: args.oldValue,
-      newValue: args.newValue });
+      newValue: args.newValue
+    });
   }
 
-
   private _outputs: IOutputAreaModel = null;
 }
 
-
 /**
  * The namespace for `CodeCellModel` statics.
  */
-export
-namespace CodeCellModel {
+export namespace CodeCellModel {
   /**
    * The options used to initialize a `CodeCellModel`.
    */
-  export
-  interface IOptions extends CellModel.IOptions {
+  export interface IOptions extends CellModel.IOptions {
     /**
      * The factory for output area model creation.
      */
@@ -609,8 +576,7 @@ namespace CodeCellModel {
   /**
    * A factory for creating code cell model content.
    */
-  export
-  interface IContentFactory {
+  export interface IContentFactory {
     /**
      * Create an output area.
      */
@@ -620,8 +586,7 @@ namespace CodeCellModel {
   /**
    * The default implementation of an `IContentFactory`.
    */
-  export
-  class ContentFactory implements IContentFactory {
+  export class ContentFactory implements IContentFactory {
     /**
      * Create an output area.
      */
@@ -633,6 +598,5 @@ namespace CodeCellModel {
   /**
    * The shared `ContentFactory` instance.
    */
-  export
-  const defaultContentFactory = new ContentFactory();
+  export const defaultContentFactory = new ContentFactory();
 }

+ 151 - 121
packages/console-extension/src/index.ts

@@ -2,102 +2,80 @@
 // Distributed under the terms of the Modified BSD License.
 
 import {
-  ILayoutRestorer, JupyterLab, JupyterLabPlugin
+  ILayoutRestorer,
+  JupyterLab,
+  JupyterLabPlugin
 } from '@jupyterlab/application';
 
 import {
-  Dialog, IClientSession, ICommandPalette, InstanceTracker, showDialog
+  Dialog,
+  IClientSession,
+  ICommandPalette,
+  InstanceTracker,
+  showDialog
 } from '@jupyterlab/apputils';
 
-import {
-  IEditorServices
-} from '@jupyterlab/codeeditor';
+import { IEditorServices } from '@jupyterlab/codeeditor';
 
-import {
-  ConsolePanel, IConsoleTracker
-} from '@jupyterlab/console';
+import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
 
-import {
-  ISettingRegistry, PageConfig
-} from '@jupyterlab/coreutils';
+import { ISettingRegistry, PageConfig } from '@jupyterlab/coreutils';
 
-import {
-  IFileBrowserFactory
-} from '@jupyterlab/filebrowser';
+import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
 
-import {
-  ILauncher
-} from '@jupyterlab/launcher';
+import { ILauncher } from '@jupyterlab/launcher';
 
 import {
-  IEditMenu, IFileMenu, IHelpMenu, IKernelMenu, IMainMenu, IRunMenu
+  IEditMenu,
+  IFileMenu,
+  IHelpMenu,
+  IKernelMenu,
+  IMainMenu,
+  IRunMenu
 } from '@jupyterlab/mainmenu';
 
-import {
-  IRenderMimeRegistry
-} from '@jupyterlab/rendermime';
-
-import {
-  find
-} from '@phosphor/algorithm';
+import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
 
-import {
-  JSONExt, ReadonlyJSONObject
-} from '@phosphor/coreutils';
+import { find } from '@phosphor/algorithm';
 
-import {
-  DockLayout, Menu
-} from '@phosphor/widgets';
+import { JSONExt, ReadonlyJSONObject } from '@phosphor/coreutils';
 
+import { DockLayout, Menu } from '@phosphor/widgets';
 
 /**
  * The command IDs used by the console plugin.
  */
 namespace CommandIDs {
-  export
-  const create = 'console:create';
+  export const create = 'console:create';
 
-  export
-  const clear = 'console:clear';
+  export const clear = 'console:clear';
 
-  export
-  const runUnforced = 'console:run-unforced';
+  export const runUnforced = 'console:run-unforced';
 
-  export
-  const runForced = 'console:run-forced';
+  export const runForced = 'console:run-forced';
 
-  export
-  const linebreak = 'console:linebreak';
+  export const linebreak = 'console:linebreak';
 
-  export
-  const interrupt = 'console:interrupt-kernel';
+  export const interrupt = 'console:interrupt-kernel';
 
-  export
-  const restart = 'console:restart-kernel';
+  export const restart = 'console:restart-kernel';
 
-  export
-  const closeAndShutdown = 'console:close-and-shutdown';
+  export const closeAndShutdown = 'console:close-and-shutdown';
 
-  export
-  const open = 'console:open';
+  export const open = 'console:open';
 
-  export
-  const inject = 'console:inject';
+  export const inject = 'console:inject';
 
-  export
-  const changeKernel = 'console:change-kernel';
+  export const changeKernel = 'console:change-kernel';
 
-  export
-  const toggleShowAllActivity = 'console:toggle-show-all-kernel-activity';
+  export const toggleShowAllActivity =
+    'console:toggle-show-all-kernel-activity';
 
-  export
-  const enterToExecute = 'console:enter-to-execute';
+  export const enterToExecute = 'console:enter-to-execute';
 
-  export
-  const shiftEnterToExecute = 'console:shift-enter-to-execute';
+  export const shiftEnterToExecute = 'console:shift-enter-to-execute';
 }
 
-
 /**
  * The console widget tracker provider.
  */
@@ -119,7 +97,6 @@ const tracker: JupyterLabPlugin<IConsoleTracker> = {
   autoStart: true
 };
 
-
 /**
  * The console widget content factory.
  */
@@ -134,18 +111,27 @@ const factory: JupyterLabPlugin<ConsolePanel.IContentFactory> = {
   }
 };
 
-
 /**
  * Export the plugins as the default.
  */
 const plugins: JupyterLabPlugin<any>[] = [factory, tracker];
 export default plugins;
 
-
 /**
  * Activate the console extension.
  */
-function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette, contentFactory: ConsolePanel.IContentFactory,  editorServices: IEditorServices, restorer: ILayoutRestorer, browserFactory: IFileBrowserFactory, rendermime: IRenderMimeRegistry, settingRegistry: ISettingRegistry, launcher: ILauncher | null): IConsoleTracker {
+function activateConsole(
+  app: JupyterLab,
+  mainMenu: IMainMenu,
+  palette: ICommandPalette,
+  contentFactory: ConsolePanel.IContentFactory,
+  editorServices: IEditorServices,
+  restorer: ILayoutRestorer,
+  browserFactory: IFileBrowserFactory,
+  rendermime: IRenderMimeRegistry,
+  settingRegistry: ISettingRegistry,
+  launcher: ILauncher | null
+): IConsoleTracker {
   const manager = app.serviceManager;
   const { commands, shell } = app;
   const category = 'Console';
@@ -220,37 +206,39 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
    */
   function createConsole(options: ICreateOptions): Promise<ConsolePanel> {
     let panel: ConsolePanel;
-    return manager.ready.then(() => {
-      panel = new ConsolePanel({
-        manager,
-        contentFactory,
-        mimeTypeService: editorServices.mimeTypeService,
-        rendermime,
-        setBusy: app.setBusy.bind(app),
-        ...options as Partial<ConsolePanel.IOptions>
-      });
+    return manager.ready
+      .then(() => {
+        panel = new ConsolePanel({
+          manager,
+          contentFactory,
+          mimeTypeService: editorServices.mimeTypeService,
+          rendermime,
+          setBusy: app.setBusy.bind(app),
+          ...(options as Partial<ConsolePanel.IOptions>)
+        });
 
-      return panel.session.ready;
-    }).then(() => {
-      // Add the console panel to the tracker.
-      tracker.add(panel);
-      shell.addToMainArea(
-        panel, {
+        return panel.session.ready;
+      })
+      .then(() => {
+        // Add the console panel to the tracker.
+        tracker.add(panel);
+        shell.addToMainArea(panel, {
           ref: options.ref,
           mode: options.insertMode,
           activate: options.activate
-        }
-      );
-      return panel;
-    });
+        });
+        return panel;
+      });
   }
 
   /**
    * Whether there is an active console.
    */
   function isEnabled(): boolean {
-    return tracker.currentWidget !== null
-           && tracker.currentWidget === app.shell.currentWidget;
+    return (
+      tracker.currentWidget !== null &&
+      tracker.currentWidget === app.shell.currentWidget
+    );
   }
 
   /**
@@ -286,7 +274,7 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
           return Promise.reject(`No running kernel session for path: ${path}`);
         });
       }
-    },
+    }
   });
 
   command = CommandIDs.create;
@@ -295,15 +283,18 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
       if (args['isPalette']) {
         return 'New Console';
       } else if (args['isLauncher'] && args['kernelPreference']) {
-        const kernelPreference =
-          args['kernelPreference'] as IClientSession.IKernelPreference;
+        const kernelPreference = args[
+          'kernelPreference'
+        ] as IClientSession.IKernelPreference;
         return manager.specs.kernelspecs[kernelPreference.name].display_name;
       }
       return 'Console';
     },
-    iconClass: args => args['isPalette'] ? '' : 'jp-CodeConsoleIcon',
+    iconClass: args => (args['isPalette'] ? '' : 'jp-CodeConsoleIcon'),
     execute: args => {
-      let basePath = args['basePath'] as string || args['cwd'] as string ||
+      let basePath =
+        (args['basePath'] as string) ||
+        (args['cwd'] as string) ||
         browserFactory.defaultBrowser.model.path;
       return createConsole({ basePath, ...args });
     }
@@ -456,9 +447,10 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
       }
       current.console.showAllActivity = !current.console.showAllActivity;
     },
-    isToggled: () => tracker.currentWidget ?
-                     tracker.currentWidget.console.showAllActivity :
-                     false,
+    isToggled: () =>
+      tracker.currentWidget
+        ? tracker.currentWidget.console.showAllActivity
+        : false,
     isEnabled
   });
 
@@ -467,12 +459,18 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
   const selector = '.jp-CodeConsole-promptCell';
 
   // Keep updated keybindings for the console commands related to execution.
-  let linebreak = find(commands.keyBindings,
-    kb => kb.command === CommandIDs.linebreak);
-  let runUnforced = find(commands.keyBindings,
-    kb => kb.command === CommandIDs.runUnforced);
-  let runForced = find(commands.keyBindings,
-    kb => kb.command === CommandIDs.runForced);
+  let linebreak = find(
+    commands.keyBindings,
+    kb => kb.command === CommandIDs.linebreak
+  );
+  let runUnforced = find(
+    commands.keyBindings,
+    kb => kb.command === CommandIDs.runUnforced
+  );
+  let runForced = find(
+    commands.keyBindings,
+    kb => kb.command === CommandIDs.runForced
+  );
   commands.keyBindingChanged.connect((s, args) => {
     if (args.binding.command === CommandIDs.linebreak) {
       linebreak = args.type === 'added' ? args.binding : undefined;
@@ -493,9 +491,13 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     isToggled: () => {
       // Only show as toggled if the shortcuts are strictly
       // The Shift+Enter ones.
-      return linebreak && JSONExt.deepEqual(linebreak.keys, ['Enter']) &&
-             runUnforced === undefined &&
-             runForced && JSONExt.deepEqual(runForced.keys, ['Shift Enter']);
+      return (
+        linebreak &&
+        JSONExt.deepEqual(linebreak.keys, ['Enter']) &&
+        runUnforced === undefined &&
+        runForced &&
+        JSONExt.deepEqual(runForced.keys, ['Shift Enter'])
+      );
     },
     execute: () => {
       const first = settingRegistry.set(shortcutPlugin, CommandIDs.linebreak, {
@@ -503,7 +505,10 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
         keys: ['Enter'],
         selector
       });
-      const second = settingRegistry.remove(shortcutPlugin, CommandIDs.runUnforced);
+      const second = settingRegistry.remove(
+        shortcutPlugin,
+        CommandIDs.runUnforced
+      );
       const third = settingRegistry.set(shortcutPlugin, CommandIDs.runForced, {
         command: CommandIDs.runForced,
         keys: ['Shift Enter'],
@@ -519,9 +524,14 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     isToggled: () => {
       // Only show as toggled if the shortcuts are strictly
       // The Enter ones.
-      return linebreak && JSONExt.deepEqual(linebreak.keys, ['Ctrl Enter']) &&
-             runUnforced && JSONExt.deepEqual(runUnforced.keys, ['Enter']) &&
-             runForced && JSONExt.deepEqual(runForced.keys, ['Shift Enter']);
+      return (
+        linebreak &&
+        JSONExt.deepEqual(linebreak.keys, ['Ctrl Enter']) &&
+        runUnforced &&
+        JSONExt.deepEqual(runUnforced.keys, ['Enter']) &&
+        runForced &&
+        JSONExt.deepEqual(runForced.keys, ['Shift Enter'])
+      );
     },
     execute: () => {
       const first = settingRegistry.set(shortcutPlugin, CommandIDs.linebreak, {
@@ -529,11 +539,15 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
         keys: ['Ctrl Enter'],
         selector
       });
-      const second = settingRegistry.set(shortcutPlugin, CommandIDs.runUnforced, {
-        command: CommandIDs.runUnforced,
-        keys: ['Enter'],
-        selector
-      });
+      const second = settingRegistry.set(
+        shortcutPlugin,
+        CommandIDs.runUnforced,
+        {
+          command: CommandIDs.runUnforced,
+          keys: ['Enter'],
+          selector
+        }
+      );
       const third = settingRegistry.set(shortcutPlugin, CommandIDs.runForced, {
         command: CommandIDs.runForced,
         keys: ['Shift Enter'],
@@ -555,7 +569,7 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     CommandIDs.interrupt,
     CommandIDs.changeKernel,
     CommandIDs.closeAndShutdown,
-    CommandIDs.toggleShowAllActivity,
+    CommandIDs.toggleShowAllActivity
   ].forEach(command => {
     palette.addItem({ command, category, args: { isPalette: true } });
   });
@@ -598,8 +612,7 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     noun: 'Console',
     restartKernel: current => current.console.session.restart(),
     restartKernelAndClear: current => {
-      return current.console.session.restart()
-      .then(restarted => {
+      return current.console.session.restart().then(restarted => {
         if (restarted) {
           current.console.clear();
         }
@@ -622,7 +635,9 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
   mainMenu.editMenu.clearers.add({
     tracker,
     noun: 'Console Cells',
-    clearCurrent: (current: ConsolePanel) => { return current.console.clear(); }
+    clearCurrent: (current: ConsolePanel) => {
+      return current.console.clear();
+    }
   } as IEditMenu.IClearer<ConsolePanel>);
 
   // Add the execute keystroke setting submenu.
@@ -630,9 +645,15 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
   executeMenu.title.label = 'Console Run Keystroke';
   executeMenu.addItem({ command: CommandIDs.enterToExecute });
   executeMenu.addItem({ command: CommandIDs.shiftEnterToExecute });
-  mainMenu.settingsMenu.addGroup([{
-    type: 'submenu' as Menu.ItemType, submenu: executeMenu
-  }], 10);
+  mainMenu.settingsMenu.addGroup(
+    [
+      {
+        type: 'submenu' as Menu.ItemType,
+        submenu: executeMenu
+      }
+    ],
+    10
+  );
 
   // Add kernel information to the application help menu.
   mainMenu.helpMenu.kernelUsers.add({
@@ -640,9 +661,18 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     getKernel: current => current.session.kernel
   } as IHelpMenu.IKernelUser<ConsolePanel>);
 
-  app.contextMenu.addItem({command: CommandIDs.clear, selector: '.jp-CodeConsole-content'});
-  app.contextMenu.addItem({command: CommandIDs.restart, selector: '.jp-CodeConsole'});
-  app.contextMenu.addItem({command: CommandIDs.toggleShowAllActivity, selector: '.jp-CodeConsole'});
+  app.contextMenu.addItem({
+    command: CommandIDs.clear,
+    selector: '.jp-CodeConsole-content'
+  });
+  app.contextMenu.addItem({
+    command: CommandIDs.restart,
+    selector: '.jp-CodeConsole'
+  });
+  app.contextMenu.addItem({
+    command: CommandIDs.toggleShowAllActivity,
+    selector: '.jp-CodeConsole'
+  });
 
   return tracker;
 }

+ 93 - 118
packages/console/src/widget.ts

@@ -1,59 +1,41 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-import {
-  IClientSession
-} from '@jupyterlab/apputils';
+import { IClientSession } from '@jupyterlab/apputils';
 
 import {
-  Cell, CellModel, CodeCell, CodeCellModel, ICodeCellModel, isCodeCellModel, IRawCellModel,
-  RawCell, RawCellModel
+  Cell,
+  CellModel,
+  CodeCell,
+  CodeCellModel,
+  ICodeCellModel,
+  isCodeCellModel,
+  IRawCellModel,
+  RawCell,
+  RawCellModel
 } from '@jupyterlab/cells';
 
-import {
-  IEditorMimeTypeService, CodeEditor
-} from '@jupyterlab/codeeditor';
+import { IEditorMimeTypeService, CodeEditor } from '@jupyterlab/codeeditor';
 
-import {
-  nbformat
-} from '@jupyterlab/coreutils';
+import { nbformat } from '@jupyterlab/coreutils';
 
-import {
-  IObservableList, ObservableList
-} from '@jupyterlab/observables';
+import { IObservableList, ObservableList } from '@jupyterlab/observables';
 
-import {
-  RenderMimeRegistry
-} from '@jupyterlab/rendermime';
-
-import {
-  KernelMessage
-} from '@jupyterlab/services';
+import { RenderMimeRegistry } from '@jupyterlab/rendermime';
 
-import {
-  each
-} from '@phosphor/algorithm';
+import { KernelMessage } from '@jupyterlab/services';
 
-import {
-  Message
-} from '@phosphor/messaging';
+import { each } from '@phosphor/algorithm';
 
-import {
-  ISignal, Signal
-} from '@phosphor/signaling';
+import { Message } from '@phosphor/messaging';
 
-import {
-  Panel, PanelLayout, Widget
-} from '@phosphor/widgets';
+import { ISignal, Signal } from '@phosphor/signaling';
 
-import {
-  ForeignHandler
-} from './foreign';
+import { Panel, PanelLayout, Widget } from '@phosphor/widgets';
 
-import {
-  ConsoleHistory, IConsoleHistory
-} from './history';
+import { ForeignHandler } from './foreign';
 
+import { ConsoleHistory, IConsoleHistory } from './history';
 
 /**
  * The data attribute added to a widget that has an active kernel.
@@ -100,7 +82,6 @@ const INPUT_CLASS = 'jp-CodeConsole-input';
  */
 const EXECUTION_TIMEOUT = 250;
 
-
 /**
  * A widget containing a Jupyter console.
  *
@@ -108,8 +89,7 @@ const EXECUTION_TIMEOUT = 250;
  * The CodeConsole class is intended to be used within a ConsolePanel
  * instance. Under most circumstances, it is not instantiated by user code.
  */
-export
-class CodeConsole extends Widget {
+export class CodeConsole extends Widget {
   /**
    * Construct a console widget.
    */
@@ -118,20 +98,17 @@ class CodeConsole extends Widget {
     this.addClass(CONSOLE_CLASS);
     this.node.dataset[KERNEL_USER] = 'true';
     this.node.dataset[CODE_RUNNER] = 'true';
-    this.node.tabIndex = -1;  // Allow the widget to take focus.
+    this.node.tabIndex = -1; // Allow the widget to take focus.
 
     // Create the panels that hold the content and input.
-    const layout = this.layout = new PanelLayout();
+    const layout = (this.layout = new PanelLayout());
     this._cells = new ObservableList<Cell>();
     this._content = new Panel();
     this._input = new Panel();
 
-    this.contentFactory = (
-      options.contentFactory || CodeConsole.defaultContentFactory
-    );
-    this.modelFactory = (
-      options.modelFactory || CodeConsole.defaultModelFactory
-    );
+    this.contentFactory =
+      options.contentFactory || CodeConsole.defaultContentFactory;
+    this.modelFactory = options.modelFactory || CodeConsole.defaultModelFactory;
     this.rendermime = options.rendermime;
     this.session = options.session;
     this._mimeTypeService = options.mimeTypeService;
@@ -209,8 +186,8 @@ class CodeConsole extends Widget {
    * The console input prompt cell.
    */
   get promptCell(): CodeCell | null {
-    let inputLayout = (this._input.layout as PanelLayout);
-    return inputLayout.widgets[0] as CodeCell || null;
+    let inputLayout = this._input.layout as PanelLayout;
+    return (inputLayout.widgets[0] as CodeCell) || null;
   }
 
   /**
@@ -240,10 +217,10 @@ class CodeConsole extends Widget {
     // Create the banner.
     let model = this.modelFactory.createRawCell({});
     model.value.text = '...';
-    let banner = this._banner = new RawCell({
+    let banner = (this._banner = new RawCell({
       model,
       contentFactory: this.contentFactory
-    });
+    }));
     banner.addClass(BANNER_CLASS);
     banner.readOnly = true;
     this._content.addWidget(banner);
@@ -388,14 +365,14 @@ class CodeConsole extends Widget {
    */
   handleEvent(event: Event): void {
     switch (event.type) {
-    case 'keydown':
-      this._evtKeyDown(event as KeyboardEvent);
-      break;
-    case 'click':
-      this._evtClick(event as MouseEvent);
-      break;
-    default:
-      break;
+      case 'keydown':
+        this._evtKeyDown(event as KeyboardEvent);
+        break;
+      case 'click':
+        this._evtClick(event as MouseEvent);
+        break;
+      default:
+        break;
     }
   }
 
@@ -493,7 +470,10 @@ class CodeConsole extends Widget {
    * Handle the `'click'` event for the widget.
    */
   private _evtClick(event: MouseEvent): void {
-    if (this.promptCell && this.promptCell.node.contains(event.target as HTMLElement)) {
+    if (
+      this.promptCell &&
+      this.promptCell.node.contains(event.target as HTMLElement)
+    ) {
       this.promptCell.editor.focus();
     }
   }
@@ -506,7 +486,7 @@ class CodeConsole extends Widget {
     this._history.push(source);
     // If the source of the console is just "clear", clear the console as we
     // do in IPython or QtConsole.
-    if ( source === 'clear' || source === '%clear' ) {
+    if (source === 'clear' || source === '%clear') {
       this.clear();
       return Promise.resolve(void 0);
     }
@@ -574,7 +554,7 @@ class CodeConsole extends Widget {
   private _createCodeCellOptions(): CodeCell.IOptions {
     let contentFactory = this.contentFactory;
     let modelFactory = this.modelFactory;
-    let model = modelFactory.createCodeCell({ });
+    let model = modelFactory.createCodeCell({});
     let rendermime = this.rendermime;
     return { model, rendermime, contentFactory };
   }
@@ -599,23 +579,30 @@ class CodeConsole extends Widget {
     let model = promptCell.model;
     let code = model.value.text;
     return new Promise<boolean>((resolve, reject) => {
-      let timer = setTimeout(() => { resolve(true); }, timeout);
+      let timer = setTimeout(() => {
+        resolve(true);
+      }, timeout);
       let kernel = this.session.kernel;
       if (!kernel) {
         resolve(false);
         return;
       }
-      kernel.requestIsComplete({ code }).then(isComplete => {
-        clearTimeout(timer);
-        if (this.isDisposed) {
+      kernel
+        .requestIsComplete({ code })
+        .then(isComplete => {
+          clearTimeout(timer);
+          if (this.isDisposed) {
+            resolve(false);
+          }
+          if (isComplete.content.status !== 'incomplete') {
+            resolve(true);
+            return;
+          }
           resolve(false);
-        }
-        if (isComplete.content.status !== 'incomplete') {
+        })
+        .catch(() => {
           resolve(true);
-          return;
-        }
-        resolve(false);
-      }).catch(() => { resolve(true); });
+        });
     });
   }
 
@@ -649,14 +636,17 @@ class CodeConsole extends Widget {
       if (!kernel) {
         return;
       }
-      kernel.requestKernelInfo().then(() => {
-        if (this.isDisposed || !kernel || !kernel.info) {
-          return;
-        }
-        this._handleInfo(this.session.kernel.info);
-      }).catch(err => {
-        console.error('could not get kernel info');
-      });
+      kernel
+        .requestKernelInfo()
+        .then(() => {
+          if (this.isDisposed || !kernel || !kernel.info) {
+            return;
+          }
+          this._handleInfo(this.session.kernel.info);
+        })
+        .catch(err => {
+          console.error('could not get kernel info');
+        });
     } else if (this.session.status === 'restarting') {
       this.addBanner();
     }
@@ -667,24 +657,21 @@ class CodeConsole extends Widget {
   private _content: Panel;
   private _executed = new Signal<this, Date>(this);
   private _foreignHandler: ForeignHandler;
-  private _history: IConsoleHistory ;
+  private _history: IConsoleHistory;
   private _input: Panel;
   private _mimetype = 'text/x-ipython';
   private _mimeTypeService: IEditorMimeTypeService;
   private _promptCellCreated = new Signal<this, CodeCell>(this);
 }
 
-
 /**
  * A namespace for CodeConsole statics.
  */
-export
-namespace CodeConsole {
+export namespace CodeConsole {
   /**
    * The initialization options for a console widget.
    */
-  export
-  interface IOptions {
+  export interface IOptions {
     /**
      * The content factory for the console widget.
      */
@@ -714,8 +701,7 @@ namespace CodeConsole {
   /**
    * A content factory for console children.
    */
-  export
-  interface IContentFactory extends Cell.IContentFactory {
+  export interface IContentFactory extends Cell.IContentFactory {
     /**
      * Create a new code cell widget.
      */
@@ -730,9 +716,8 @@ namespace CodeConsole {
   /**
    * Default implementation of `IContentFactory`.
    */
-  export
-  class ContentFactory extends Cell.ContentFactory implements IContentFactory {
-
+  export class ContentFactory extends Cell.ContentFactory
+    implements IContentFactory {
     /**
      * Create a new code cell widget.
      *
@@ -765,29 +750,25 @@ namespace CodeConsole {
   /**
    * A namespace for the code console content factory.
    */
-  export
-  namespace ContentFactory {
+  export namespace ContentFactory {
     /**
      * An initialize options for `ContentFactory`.
      */
-    export
-    interface IOptions extends Cell.IContentFactory { }
+    export interface IOptions extends Cell.IContentFactory {}
   }
 
   /**
    * A default content factory for the code console.
    */
-  export
-  const defaultContentFactory: IContentFactory = new ContentFactory();
+  export const defaultContentFactory: IContentFactory = new ContentFactory();
 
   /**
    * A model factory for a console widget.
    */
-  export
-  interface IModelFactory {
-   /**
-    * The factory for code cell content.
-    */
+  export interface IModelFactory {
+    /**
+     * The factory for code cell content.
+     */
     readonly codeCellContentFactory: CodeCellModel.IContentFactory;
 
     /**
@@ -814,15 +795,13 @@ namespace CodeConsole {
   /**
    * The default implementation of an `IModelFactory`.
    */
-  export
-  class ModelFactory {
+  export class ModelFactory {
     /**
      * Create a new cell model factory.
      */
     constructor(options: IModelFactoryOptions = {}) {
-      this.codeCellContentFactory = (options.codeCellContentFactory ||
-        CodeCellModel.defaultContentFactory
-      );
+      this.codeCellContentFactory =
+        options.codeCellContentFactory || CodeCellModel.defaultContentFactory;
     }
 
     /**
@@ -856,15 +835,14 @@ namespace CodeConsole {
      *   new cell will be intialized with the data from the source.
      */
     createRawCell(options: CellModel.IOptions): IRawCellModel {
-     return new RawCellModel(options);
+      return new RawCellModel(options);
     }
   }
 
   /**
    * The options used to initialize a `ModelFactory`.
    */
-  export
-  interface IModelFactoryOptions {
+  export interface IModelFactoryOptions {
     /**
      * The factory for output area models.
      */
@@ -874,11 +852,9 @@ namespace CodeConsole {
   /**
    * The default `ModelFactory` instance.
    */
-  export
-  const defaultModelFactory = new ModelFactory({});
+  export const defaultModelFactory = new ModelFactory({});
 }
 
-
 /**
  * A namespace for console widget private data.
  */
@@ -888,8 +864,7 @@ namespace Private {
    *
    * @param node - The scrollable element.
    */
-  export
-  function scrollToBottom(node: HTMLElement): void {
+  export function scrollToBottom(node: HTMLElement): void {
     node.scrollTop = node.scrollHeight - node.clientHeight;
   }
 }

+ 315 - 297
packages/notebook-extension/src/index.ts

@@ -2,262 +2,199 @@
 // Distributed under the terms of the Modified BSD License.
 
 import {
-  ILayoutRestorer, JupyterLab, JupyterLabPlugin
+  ILayoutRestorer,
+  JupyterLab,
+  JupyterLabPlugin
 } from '@jupyterlab/application';
 
 import {
-  Dialog, ICommandPalette, MainAreaWidget, showDialog
+  Dialog,
+  ICommandPalette,
+  MainAreaWidget,
+  showDialog
 } from '@jupyterlab/apputils';
 
-import {
-  CodeCell
-} from '@jupyterlab/cells';
+import { CodeCell } from '@jupyterlab/cells';
 
-import {
-  CodeEditor, IEditorServices
-} from '@jupyterlab/codeeditor';
+import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor';
 
 import {
-  ISettingRegistry, IStateDB, PageConfig, URLExt, uuid
+  ISettingRegistry,
+  IStateDB,
+  PageConfig,
+  URLExt,
+  uuid
 } from '@jupyterlab/coreutils';
 
-import  {
-  IFileBrowserFactory
-} from '@jupyterlab/filebrowser';
+import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
 
-import {
-  ILauncher
-} from '@jupyterlab/launcher';
+import { ILauncher } from '@jupyterlab/launcher';
 
 import {
-  IMainMenu, IEditMenu, IFileMenu, IHelpMenu, IKernelMenu, IRunMenu, IViewMenu
+  IMainMenu,
+  IEditMenu,
+  IFileMenu,
+  IHelpMenu,
+  IKernelMenu,
+  IRunMenu,
+  IViewMenu
 } from '@jupyterlab/mainmenu';
 
 import {
-  CellTools, ICellTools, INotebookTracker, NotebookActions,
-  NotebookModelFactory, NotebookPanel, NotebookTracker, NotebookWidgetFactory,
+  CellTools,
+  ICellTools,
+  INotebookTracker,
+  NotebookActions,
+  NotebookModelFactory,
+  NotebookPanel,
+  NotebookTracker,
+  NotebookWidgetFactory,
   StaticNotebook
 } from '@jupyterlab/notebook';
 
-import {
-  IRenderMimeRegistry
-} from '@jupyterlab/rendermime';
-
-import {
-  ServiceManager
-} from '@jupyterlab/services';
+import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
 
-import {
-  ReadonlyJSONObject
-} from '@phosphor/coreutils';
+import { ServiceManager } from '@jupyterlab/services';
 
-import {
-  Message, MessageLoop
-} from '@phosphor/messaging';
+import { ReadonlyJSONObject } from '@phosphor/coreutils';
 
-import {
-  Menu
-} from '@phosphor/widgets';
+import { Message, MessageLoop } from '@phosphor/messaging';
 
+import { Menu } from '@phosphor/widgets';
 
 /**
  * The command IDs used by the notebook plugin.
  */
 namespace CommandIDs {
-  export
-  const createNew = 'notebook:create-new';
+  export const createNew = 'notebook:create-new';
 
-  export
-  const interrupt = 'notebook:interrupt-kernel';
+  export const interrupt = 'notebook:interrupt-kernel';
 
-  export
-  const restart = 'notebook:restart-kernel';
+  export const restart = 'notebook:restart-kernel';
 
-  export
-  const restartClear = 'notebook:restart-clear-output';
+  export const restartClear = 'notebook:restart-clear-output';
 
-  export
-  const restartRunAll = 'notebook:restart-run-all';
+  export const restartRunAll = 'notebook:restart-run-all';
 
-  export
-  const reconnectToKernel = 'notebook:reconnect-to-kernel';
+  export const reconnectToKernel = 'notebook:reconnect-to-kernel';
 
-  export
-  const changeKernel = 'notebook:change-kernel';
+  export const changeKernel = 'notebook:change-kernel';
 
-  export
-  const createConsole = 'notebook:create-console';
+  export const createConsole = 'notebook:create-console';
 
-  export
-  const createOutputView = 'notebook:create-output-view';
+  export const createOutputView = 'notebook:create-output-view';
 
-  export
-  const clearAllOutputs = 'notebook:clear-all-cell-outputs';
+  export const clearAllOutputs = 'notebook:clear-all-cell-outputs';
 
-  export
-  const closeAndShutdown = 'notebook:close-and-shutdown';
+  export const closeAndShutdown = 'notebook:close-and-shutdown';
 
-  export
-  const trust = 'notebook:trust';
+  export const trust = 'notebook:trust';
 
-  export
-  const exportToFormat = 'notebook:export-to-format';
+  export const exportToFormat = 'notebook:export-to-format';
 
-  export
-  const run = 'notebook:run-cell';
+  export const run = 'notebook:run-cell';
 
-  export
-  const runAndAdvance = 'notebook:run-cell-and-select-next';
+  export const runAndAdvance = 'notebook:run-cell-and-select-next';
 
-  export
-  const runAndInsert = 'notebook:run-cell-and-insert-below';
+  export const runAndInsert = 'notebook:run-cell-and-insert-below';
 
-  export
-  const runInConsole = 'notebook:run-in-console';
+  export const runInConsole = 'notebook:run-in-console';
 
-  export
-  const runAll = 'notebook:run-all-cells';
+  export const runAll = 'notebook:run-all-cells';
 
-  export
-  const runAllAbove = 'notebook:run-all-above';
+  export const runAllAbove = 'notebook:run-all-above';
 
-  export
-  const runAllBelow = 'notebook:run-all-below';
+  export const runAllBelow = 'notebook:run-all-below';
 
-  export
-  const toCode = 'notebook:change-cell-to-code';
+  export const toCode = 'notebook:change-cell-to-code';
 
-  export
-  const toMarkdown = 'notebook:change-cell-to-markdown';
+  export const toMarkdown = 'notebook:change-cell-to-markdown';
 
-  export
-  const toRaw = 'notebook:change-cell-to-raw';
+  export const toRaw = 'notebook:change-cell-to-raw';
 
-  export
-  const cut = 'notebook:cut-cell';
+  export const cut = 'notebook:cut-cell';
 
-  export
-  const copy = 'notebook:copy-cell';
+  export const copy = 'notebook:copy-cell';
 
-  export
-  const pasteAbove = 'notebook:paste-cell-above';
+  export const pasteAbove = 'notebook:paste-cell-above';
 
-  export
-  const pasteBelow = 'notebook:paste-cell-below';
+  export const pasteBelow = 'notebook:paste-cell-below';
 
-  export
-  const pasteAndReplace = 'notebook:paste-and-replace-cell';
+  export const pasteAndReplace = 'notebook:paste-and-replace-cell';
 
-  export
-  const moveUp = 'notebook:move-cell-up';
+  export const moveUp = 'notebook:move-cell-up';
 
-  export
-  const moveDown = 'notebook:move-cell-down';
+  export const moveDown = 'notebook:move-cell-down';
 
-  export
-  const clearOutputs = 'notebook:clear-cell-output';
+  export const clearOutputs = 'notebook:clear-cell-output';
 
-  export
-  const deleteCell = 'notebook:delete-cell';
+  export const deleteCell = 'notebook:delete-cell';
 
-  export
-  const insertAbove = 'notebook:insert-cell-above';
+  export const insertAbove = 'notebook:insert-cell-above';
 
-  export
-  const insertBelow = 'notebook:insert-cell-below';
+  export const insertBelow = 'notebook:insert-cell-below';
 
-  export
-  const selectAbove = 'notebook:move-cursor-up';
+  export const selectAbove = 'notebook:move-cursor-up';
 
-  export
-  const selectBelow = 'notebook:move-cursor-down';
+  export const selectBelow = 'notebook:move-cursor-down';
 
-  export
-  const extendAbove = 'notebook:extend-marked-cells-above';
+  export const extendAbove = 'notebook:extend-marked-cells-above';
 
-  export
-  const extendBelow = 'notebook:extend-marked-cells-below';
+  export const extendBelow = 'notebook:extend-marked-cells-below';
 
-  export
-  const selectAll = 'notebook:select-all';
+  export const selectAll = 'notebook:select-all';
 
-  export
-  const deselectAll = 'notebook:deselect-all';
+  export const deselectAll = 'notebook:deselect-all';
 
-  export
-  const editMode = 'notebook:enter-edit-mode';
+  export const editMode = 'notebook:enter-edit-mode';
 
-  export
-  const merge = 'notebook:merge-cells';
+  export const merge = 'notebook:merge-cells';
 
-  export
-  const split = 'notebook:split-cell-at-cursor';
+  export const split = 'notebook:split-cell-at-cursor';
 
-  export
-  const commandMode = 'notebook:enter-command-mode';
+  export const commandMode = 'notebook:enter-command-mode';
 
-  export
-  const toggleAllLines = 'notebook:toggle-all-cell-line-numbers';
+  export const toggleAllLines = 'notebook:toggle-all-cell-line-numbers';
 
-  export
-  const undoCellAction = 'notebook:undo-cell-action';
+  export const undoCellAction = 'notebook:undo-cell-action';
 
-  export
-  const redoCellAction = 'notebook:redo-cell-action';
+  export const redoCellAction = 'notebook:redo-cell-action';
 
-  export
-  const markdown1 = 'notebook:change-cell-to-heading-1';
+  export const markdown1 = 'notebook:change-cell-to-heading-1';
 
-  export
-  const markdown2 = 'notebook:change-cell-to-heading-2';
+  export const markdown2 = 'notebook:change-cell-to-heading-2';
 
-  export
-  const markdown3 = 'notebook:change-cell-to-heading-3';
+  export const markdown3 = 'notebook:change-cell-to-heading-3';
 
-  export
-  const markdown4 = 'notebook:change-cell-to-heading-4';
+  export const markdown4 = 'notebook:change-cell-to-heading-4';
 
-  export
-  const markdown5 = 'notebook:change-cell-to-heading-5';
+  export const markdown5 = 'notebook:change-cell-to-heading-5';
 
-  export
-  const markdown6 = 'notebook:change-cell-to-heading-6';
+  export const markdown6 = 'notebook:change-cell-to-heading-6';
 
-  export
-  const hideCode = 'notebook:hide-cell-code';
+  export const hideCode = 'notebook:hide-cell-code';
 
-  export
-  const showCode = 'notebook:show-cell-code';
+  export const showCode = 'notebook:show-cell-code';
 
-  export
-  const hideAllCode = 'notebook:hide-all-cell-code';
+  export const hideAllCode = 'notebook:hide-all-cell-code';
 
-  export
-  const showAllCode = 'notebook:show-all-cell-code';
+  export const showAllCode = 'notebook:show-all-cell-code';
 
-  export
-  const hideOutput = 'notebook:hide-cell-outputs';
+  export const hideOutput = 'notebook:hide-cell-outputs';
 
-  export
-  const showOutput = 'notebook:show-cell-outputs';
+  export const showOutput = 'notebook:show-cell-outputs';
 
-  export
-  const hideAllOutputs = 'notebook:hide-all-cell-outputs';
+  export const hideAllOutputs = 'notebook:hide-all-cell-outputs';
 
-  export
-  const showAllOutputs = 'notebook:show-all-cell-outputs';
+  export const showAllOutputs = 'notebook:show-all-cell-outputs';
 
-  export
-  const enableOutputScrolling = 'notebook:enable-output-scrolling';
+  export const enableOutputScrolling = 'notebook:enable-output-scrolling';
 
-  export
-  const disableOutputScrolling = 'notebook:disable-output-scrolling';
+  export const disableOutputScrolling = 'notebook:disable-output-scrolling';
 
-  export
-  const saveWithView = 'notebook:save-with-view';
+  export const saveWithView = 'notebook:save-with-view';
 }
 
-
 /**
  * The class name for the notebook icon from the default theme.
  */
@@ -272,16 +209,15 @@ const FACTORY = 'Notebook';
  * The allowed Export To ... formats and their human readable labels.
  */
 const EXPORT_TO_FORMATS = [
-  { 'format': 'html', 'label': 'HTML' },
-  { 'format': 'latex', 'label': 'LaTeX' },
-  { 'format': 'markdown', 'label': 'Markdown' },
-  { 'format': 'pdf', 'label': 'PDF' },
-  { 'format': 'rst', 'label': 'ReStructured Text' },
-  { 'format': 'script', 'label': 'Executable Script' },
-  { 'format': 'slides', 'label': 'Reveal.js Slides' }
+  { format: 'html', label: 'HTML' },
+  { format: 'latex', label: 'LaTeX' },
+  { format: 'markdown', label: 'Markdown' },
+  { format: 'pdf', label: 'PDF' },
+  { format: 'rst', label: 'ReStructured Text' },
+  { format: 'script', label: 'Executable Script' },
+  { format: 'slides', label: 'Reveal.js Slides' }
 ];
 
-
 /**
  * The notebook widget tracker provider.
  */
@@ -302,7 +238,6 @@ const trackerPlugin: JupyterLabPlugin<INotebookTracker> = {
   autoStart: true
 };
 
-
 /**
  * The notebook cell factory provider.
  */
@@ -328,18 +263,21 @@ const tools: JupyterLabPlugin<ICellTools> = {
   requires: [INotebookTracker, IEditorServices, IStateDB]
 };
 
-
 /**
  * Export the plugins as default.
  */
 const plugins: JupyterLabPlugin<any>[] = [factory, trackerPlugin, tools];
 export default plugins;
 
-
 /**
  * Activate the cell tools extension.
  */
-function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorServices: IEditorServices, state: IStateDB): Promise<ICellTools> {
+function activateCellTools(
+  app: JupyterLab,
+  tracker: INotebookTracker,
+  editorServices: IEditorServices,
+  state: IStateDB
+): Promise<ICellTools> {
   const id = 'cell-tools';
   const celltools = new CellTools({ tracker });
   const activeCellTool = new CellTools.ActiveCellTool();
@@ -374,7 +312,7 @@ function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorSer
 
   // Wait until the application has finished restoring before rendering.
   Promise.all([state.fetch(id), app.restored]).then(([args]) => {
-    const open = !!(args && (args as ReadonlyJSONObject)['open'] as boolean);
+    const open = !!(args && ((args as ReadonlyJSONObject)['open'] as boolean));
 
     // After initial restoration, check if the cell tools should render.
     if (tracker.size) {
@@ -402,11 +340,21 @@ function activateCellTools(app: JupyterLab, tracker: INotebookTracker, editorSer
   return Promise.resolve(celltools);
 }
 
-
 /**
  * Activate the notebook handler extension.
  */
-function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette, contentFactory: NotebookPanel.IContentFactory, editorServices: IEditorServices, restorer: ILayoutRestorer, rendermime: IRenderMimeRegistry, settingRegistry: ISettingRegistry, browserFactory: IFileBrowserFactory | null, launcher: ILauncher | null): INotebookTracker {
+function activateNotebookHandler(
+  app: JupyterLab,
+  mainMenu: IMainMenu,
+  palette: ICommandPalette,
+  contentFactory: NotebookPanel.IContentFactory,
+  editorServices: IEditorServices,
+  restorer: ILayoutRestorer,
+  rendermime: IRenderMimeRegistry,
+  settingRegistry: ISettingRegistry,
+  browserFactory: IFileBrowserFactory | null,
+  launcher: ILauncher | null
+): INotebookTracker {
   const services = app.serviceManager;
   // An object for tracking the current notebook settings.
   let editorConfig = StaticNotebook.defaultEditorConfig;
@@ -447,7 +395,9 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
     widget.id = widget.id || `notebook-${++id}`;
     widget.title.icon = NOTEBOOK_ICON_CLASS;
     // Notify the instance tracker if restore data needs to update.
-    widget.context.pathChanged.connect(() => { tracker.save(widget); });
+    widget.context.pathChanged.connect(() => {
+      tracker.save(widget);
+    });
     // Add the notebook panel to the tracker.
     tracker.add(widget);
   });
@@ -456,29 +406,35 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
    * Update the setting values.
    */
   function updateConfig(settings: ISettingRegistry.ISettings): void {
-    let cached =
-      settings.get('codeCellConfig').composite as Partial<CodeEditor.IConfig>;
+    let cached = settings.get('codeCellConfig').composite as Partial<
+      CodeEditor.IConfig
+    >;
     let code = { ...StaticNotebook.defaultEditorConfig.code };
     Object.keys(code).forEach((key: keyof CodeEditor.IConfig) => {
-      code[key] = (cached[key] === null || cached[key] === undefined)
-                  ? code[key]
-                  : cached[key];
+      code[key] =
+        cached[key] === null || cached[key] === undefined
+          ? code[key]
+          : cached[key];
     });
-    cached =
-      settings.get('markdownCellConfig').composite as Partial<CodeEditor.IConfig>;
+    cached = settings.get('markdownCellConfig').composite as Partial<
+      CodeEditor.IConfig
+    >;
     let markdown = { ...StaticNotebook.defaultEditorConfig.markdown };
     Object.keys(markdown).forEach((key: keyof CodeEditor.IConfig) => {
-      markdown[key] = (cached[key] === null || cached[key] === undefined)
-                      ? markdown[key]
-                      : cached[key];
+      markdown[key] =
+        cached[key] === null || cached[key] === undefined
+          ? markdown[key]
+          : cached[key];
     });
-    cached =
-      settings.get('rawCellConfig').composite as Partial<CodeEditor.IConfig>;
+    cached = settings.get('rawCellConfig').composite as Partial<
+      CodeEditor.IConfig
+    >;
     let raw = { ...StaticNotebook.defaultEditorConfig.raw };
     Object.keys(raw).forEach((key: keyof CodeEditor.IConfig) => {
-      raw[key] = (cached[key] === null || cached[key] === undefined)
-                 ? raw[key]
-                 : cached[key];
+      raw[key] =
+        cached[key] === null || cached[key] === undefined
+          ? raw[key]
+          : cached[key];
     });
     factory.editorConfig = editorConfig = { code, markdown, raw };
   }
@@ -487,57 +443,63 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
    * Update the settings of the current tracker instances.
    */
   function updateTracker(): void {
-    tracker.forEach(widget => { widget.content.editorConfig = editorConfig; });
+    tracker.forEach(widget => {
+      widget.content.editorConfig = editorConfig;
+    });
   }
 
   // Fetch the initial state of the settings.
-  Promise.all([settingRegistry.load(trackerPlugin.id), restored]).then(([settings]) => {
-    updateConfig(settings);
-    updateTracker();
-    settings.changed.connect(() => {
+  Promise.all([settingRegistry.load(trackerPlugin.id), restored])
+    .then(([settings]) => {
       updateConfig(settings);
       updateTracker();
+      settings.changed.connect(() => {
+        updateConfig(settings);
+        updateTracker();
+      });
+    })
+    .catch((reason: Error) => {
+      console.error(reason.message);
+      updateTracker();
     });
-  }).catch((reason: Error) => {
-    console.error(reason.message);
-    updateTracker();
-  });
 
   // Add main menu notebook menu.
   populateMenus(app, mainMenu, tracker);
 
   // Utility function to create a new notebook.
   const createNew = (cwd: string, kernelName?: string) => {
-    return commands.execute(
-      'docmanager:new-untitled', { path: cwd, type: 'notebook' }
-    ).then(model => {
-      return commands.execute('docmanager:open', {
-        path: model.path, factory: FACTORY,
-        kernel: { name: kernelName }
+    return commands
+      .execute('docmanager:new-untitled', { path: cwd, type: 'notebook' })
+      .then(model => {
+        return commands.execute('docmanager:open', {
+          path: model.path,
+          factory: FACTORY,
+          kernel: { name: kernelName }
+        });
       });
-    });
   };
 
   // Add a command for creating a new notebook.
   commands.addCommand(CommandIDs.createNew, {
     label: args => {
-      const kernelName = args['kernelName'] as string || '';
+      const kernelName = (args['kernelName'] as string) || '';
       if (args['isLauncher'] && args['kernelName']) {
         return services.specs.kernelspecs[kernelName].display_name;
       }
       return 'Notebook';
     },
     caption: 'Create a new notebook',
-    iconClass: args => args['isLauncher'] ? '' : 'jp-NotebookIcon',
+    iconClass: args => (args['isLauncher'] ? '' : 'jp-NotebookIcon'),
     execute: args => {
-      const cwd = args['cwd'] || browserFactory ?
-        browserFactory.defaultBrowser.model.path : '';
-      const kernelName = args['kernelName'] as string || '';
+      const cwd =
+        args['cwd'] || browserFactory
+          ? browserFactory.defaultBrowser.model.path
+          : '';
+      const kernelName = (args['kernelName'] as string) || '';
       return createNew(cwd, kernelName);
     }
   });
 
-
   // Add a launcher item if the launcher is available.
   if (launcher) {
     services.ready.then(() => {
@@ -626,7 +588,6 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
     rank: 11
   });
 
-
   // Notebook context menu groups
   app.contextMenu.addItem({
     command: CommandIDs.clearAllOutputs,
@@ -682,12 +643,14 @@ function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette:
   return tracker;
 }
 
-
-
 /**
  * Add the notebook commands to the application's command registry.
  */
-function addCommands(app: JupyterLab, services: ServiceManager, tracker: NotebookTracker): void {
+function addCommands(
+  app: JupyterLab,
+  services: ServiceManager,
+  tracker: NotebookTracker
+): void {
   const { commands, shell } = app;
 
   // Get the current widget and activate unless the args specify otherwise.
@@ -706,15 +669,19 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
    * Whether there is an active notebook.
    */
   function isEnabled(): boolean {
-    return tracker.currentWidget !== null &&
-           tracker.currentWidget === app.shell.currentWidget;
+    return (
+      tracker.currentWidget !== null &&
+      tracker.currentWidget === app.shell.currentWidget
+    );
   }
 
   /**
    * Whether there is an notebook active, with a single selected cell.
    */
   function isEnabledAndSingleSelected(): boolean {
-    if (!isEnabled()) { return false; }
+    if (!isEnabled()) {
+      return false;
+    }
     const { content } = tracker.currentWidget;
     const index = content.activeCellIndex;
     // If there are selections that are not the active cell,
@@ -741,7 +708,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
     isEnabled
   });
   commands.addCommand(CommandIDs.run, {
-    label: 'Run Selected Cells and Don\'t Advance',
+    label: "Run Selected Cells and Don't Advance",
     execute: args => {
       const current = getCurrent(args);
 
@@ -771,7 +738,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
     execute: args => {
       // Default to not activating the notebook (thereby putting the notebook
       // into command mode)
-      const current = getCurrent({activate: false, ...args});
+      const current = getCurrent({ activate: false, ...args });
 
       if (current) {
         const { context, content } = current;
@@ -780,7 +747,7 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
         let path = context.path;
         // ignore action in non-code cell
         if (!cell || cell.model.type !== 'code') {
-            return Promise.resolve(void 0);
+          return Promise.resolve(void 0);
         }
 
         let code = '';
@@ -799,17 +766,26 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
           code = editor.getLine(selection.start.line);
           const cursor = editor.getCursorPosition();
           if (cursor.line + 1 !== editor.lineCount) {
-            editor.setCursorPosition({ line: cursor.line + 1, column: cursor.column });
+            editor.setCursorPosition({
+              line: cursor.line + 1,
+              column: cursor.column
+            });
           }
         }
         // open a console, create if needed
         if (code) {
-          return commands.execute('console:open', {
+          return commands
+            .execute('console:open', {
               path,
               insertMode: 'split-bottom',
               activate: false
-            }).then((panel) => {
-              commands.execute('console:inject', { activate: false, code, path });
+            })
+            .then(panel => {
+              commands.execute('console:inject', {
+                activate: false,
+                code,
+                path
+              });
             });
         } else {
           return Promise.resolve(void 0);
@@ -845,8 +821,10 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
     isEnabled: () => {
       // Can't run above if there are multiple cells selected,
       // or if we are at the top of the notebook.
-      return isEnabledAndSingleSelected() &&
-             tracker.currentWidget.content.activeCellIndex !== 0;
+      return (
+        isEnabledAndSingleSelected() &&
+        tracker.currentWidget.content.activeCellIndex !== 0
+      );
     }
   });
   commands.addCommand(CommandIDs.runAllBelow, {
@@ -863,9 +841,11 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
     isEnabled: () => {
       // Can't run below if there are multiple cells selected,
       // or if we are at the bottom of the notebook.
-      return isEnabledAndSingleSelected() &&
-             tracker.currentWidget.content.activeCellIndex !==
-             tracker.currentWidget.content.widgets.length - 1;
+      return (
+        isEnabledAndSingleSelected() &&
+        tracker.currentWidget.content.activeCellIndex !==
+          tracker.currentWidget.content.widgets.length - 1
+      );
     }
   });
   commands.addCommand(CommandIDs.restart, {
@@ -896,8 +876,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
         buttons: [Dialog.cancelButton(), Dialog.warnButton()]
       }).then(result => {
         if (result.button.accept) {
-          return current.context.session.shutdown()
-            .then(() => { current.dispose(); });
+          return current.context.session.shutdown().then(() => {
+            current.dispose();
+          });
         }
       });
     },
@@ -918,9 +899,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
   });
   commands.addCommand(CommandIDs.exportToFormat, {
     label: args => {
-        const formatLabel = (args['label']) as string;
+      const formatLabel = args['label'] as string;
 
-        return (args['isPalette'] ? 'Export Notebook to ' : '') + formatLabel;
+      return (args['isPalette'] ? 'Export Notebook to ' : '') + formatLabel;
     },
     execute: args => {
       const current = getCurrent(args);
@@ -930,20 +911,23 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
       }
 
       const notebookPath = URLExt.encodeParts(current.context.path);
-      const url = URLExt.join(
-        services.serverSettings.baseUrl,
-        'nbconvert',
-        (args['format']) as string,
-        notebookPath
-      ) + '?download=true';
+      const url =
+        URLExt.join(
+          services.serverSettings.baseUrl,
+          'nbconvert',
+          args['format'] as string,
+          notebookPath
+        ) + '?download=true';
       const child = window.open('', '_blank');
       const { context } = current;
 
       if (context.model.dirty && !context.model.readOnly) {
-        return context.save().then(() => { child.location.assign(url); });
+        return context.save().then(() => {
+          child.location.assign(url);
+        });
       }
 
-      return new Promise<void>((resolve) => {
+      return new Promise<void>(resolve => {
         child.location.assign(url);
         resolve(undefined);
       });
@@ -958,8 +942,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
       if (current) {
         const { content, session } = current;
 
-        return session.restart()
-          .then(() => { NotebookActions.clearAllOutputs(content); });
+        return session.restart().then(() => {
+          NotebookActions.clearAllOutputs(content);
+        });
       }
     },
     isEnabled
@@ -1347,11 +1332,14 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
       widget.id = `LinkedOutputView-${uuid()}`;
       widget.title.label = 'Output View';
       widget.title.icon = NOTEBOOK_ICON_CLASS;
-      widget.title.caption = current.title.label ? `For Notebook: ${current.title.label}` : 'For Notebook:';
+      widget.title.caption = current.title.label
+        ? `For Notebook: ${current.title.label}`
+        : 'For Notebook:';
       widget.addClass('jp-LinkedOutputView');
-      current.context.addSibling(
-        widget, { ref: current.id, mode: 'split-bottom' }
-      );
+      current.context.addSibling(widget, {
+        ref: current.id,
+        mode: 'split-bottom'
+      });
 
       // Remove the output view if the parent notebook is closed.
       nb.disposed.connect(widget.dispose);
@@ -1570,7 +1558,6 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
   });
 }
 
-
 /**
  * Populate the application's command palette with notebook commands.
  */
@@ -1597,13 +1584,15 @@ function populatePalette(palette: ICommandPalette): void {
     CommandIDs.closeAndShutdown,
     CommandIDs.trust,
     CommandIDs.saveWithView
-  ].forEach(command => { palette.addItem({ command, category }); });
+  ].forEach(command => {
+    palette.addItem({ command, category });
+  });
 
   EXPORT_TO_FORMATS.forEach(exportToFormat => {
     let args = {
-      'format': exportToFormat['format'],
-      'label': exportToFormat['label'],
-      'isPalette': true
+      format: exportToFormat['format'],
+      label: exportToFormat['label'],
+      isPalette: true
     };
     palette.addItem({ command: CommandIDs.exportToFormat, category, args });
   });
@@ -1652,21 +1641,30 @@ function populatePalette(palette: ICommandPalette): void {
     CommandIDs.showAllOutputs,
     CommandIDs.enableOutputScrolling,
     CommandIDs.disableOutputScrolling
-  ].forEach(command => { palette.addItem({ command, category }); });
+  ].forEach(command => {
+    palette.addItem({ command, category });
+  });
 }
 
-
 /**
  * Populates the application menus for the notebook.
  */
-function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookTracker): void {
+function populateMenus(
+  app: JupyterLab,
+  mainMenu: IMainMenu,
+  tracker: INotebookTracker
+): void {
   let { commands } = app;
 
   // Add undo/redo hooks to the edit menu.
   mainMenu.editMenu.undoers.add({
     tracker,
-    undo: widget => { widget.content.activeCell.editor.undo(); },
-    redo: widget => { widget.content.activeCell.editor.redo(); }
+    undo: widget => {
+      widget.content.activeCell.editor.undo();
+    },
+    redo: widget => {
+      widget.content.activeCell.editor.redo();
+    }
   } as IEditMenu.IUndoer<NotebookPanel>);
 
   // Add a clearer to the edit menu
@@ -1698,8 +1696,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
         buttons: [Dialog.cancelButton(), Dialog.warnButton()]
       }).then(result => {
         if (result.button.accept) {
-          return current.context.session.shutdown()
-            .then(() => { current.dispose(); });
+          return current.context.session.shutdown().then(() => {
+            current.dispose();
+          });
         }
       });
     }
@@ -1717,10 +1716,13 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
   } as IFileMenu.IPersistAndSave<NotebookPanel>);
 
   // Add a notebook group to the File menu.
-  let exportTo = new Menu({ commands } );
+  let exportTo = new Menu({ commands });
   exportTo.title.label = 'Export Notebook As…';
   EXPORT_TO_FORMATS.forEach(exportToFormat => {
-    exportTo.addItem({ command: CommandIDs.exportToFormat, args: exportToFormat });
+    exportTo.addItem({
+      command: CommandIDs.exportToFormat,
+      args: exportToFormat
+    });
   });
   const fileGroup = [
     { command: CommandIDs.trust },
@@ -1749,7 +1751,7 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
       });
     },
     changeKernel: current => current.session.selectKernel(),
-    shutdownKernel: current => current.session.shutdown(),
+    shutdownKernel: current => current.session.shutdown()
   } as IKernelMenu.IKernelUser<NotebookPanel>);
 
   // Add a console creator the the Kernel menu
@@ -1774,7 +1776,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
     CommandIDs.hideOutput,
     CommandIDs.hideAllCode,
     CommandIDs.hideAllOutputs
-  ].map(command => { return { command }; });
+  ].map(command => {
+    return { command };
+  });
   mainMenu.viewMenu.addGroup(collapseGroup, 10);
 
   const expandGroup = [
@@ -1782,7 +1786,9 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
     CommandIDs.showOutput,
     CommandIDs.showAllCode,
     CommandIDs.showAllOutputs
-  ].map(command => { return { command }; });
+  ].map(command => {
+    return { command };
+  });
   mainMenu.viewMenu.addGroup(expandGroup, 11);
 
   // Add an IEditorViewer to the application view menu
@@ -1793,8 +1799,11 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
     },
     lineNumbersToggled: widget => {
       const config = widget.content.editorConfig;
-      return !!(config.code.lineNumbers && config.markdown.lineNumbers &&
-        config.raw.lineNumbers);
+      return !!(
+        config.code.lineNumbers &&
+        config.markdown.lineNumbers &&
+        config.raw.lineNumbers
+      );
     }
   } as IViewMenu.IEditorViewer<NotebookPanel>);
 
@@ -1804,18 +1813,19 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
     noun: 'Cells',
     run: current => {
       const { context, content } = current;
-      return NotebookActions.runAndAdvance(content, context.session)
-      .then(() => void 0);
+      return NotebookActions.runAndAdvance(content, context.session).then(
+        () => void 0
+      );
     },
     runAll: current => {
       const { context, content } = current;
-      return NotebookActions.runAll(content, context.session)
-      .then(() => void 0);
+      return NotebookActions.runAll(content, context.session).then(
+        () => void 0
+      );
     },
     restartAndRunAll: current => {
       const { context, content } = current;
-      return context.session.restart()
-      .then(restarted => {
+      return context.session.restart().then(restarted => {
         if (restarted) {
           NotebookActions.runAll(content, context.session);
         }
@@ -1828,44 +1838,52 @@ function populateMenus(app: JupyterLab, mainMenu: IMainMenu, tracker: INotebookT
   const runExtras = [
     CommandIDs.runAndInsert,
     CommandIDs.run,
-    CommandIDs.runInConsole,
-  ].map(command => { return { command }; });
+    CommandIDs.runInConsole
+  ].map(command => {
+    return { command };
+  });
 
   // Add a run all above/below group to the run menu.
   const runAboveBelowGroup = [
     CommandIDs.runAllAbove,
     CommandIDs.runAllBelow
-  ].map(command => { return { command }; });
+  ].map(command => {
+    return { command };
+  });
 
   // Add commands to the application edit menu.
   const undoCellActionGroup = [
     CommandIDs.undoCellAction,
     CommandIDs.redoCellAction
-  ].map(command => { return { command }; });
+  ].map(command => {
+    return { command };
+  });
 
   const copyGroup = [
     CommandIDs.cut,
     CommandIDs.copy,
     CommandIDs.pasteBelow,
     CommandIDs.pasteAbove,
-    CommandIDs.pasteAndReplace,
-  ].map(command => { return { command }; });
-
-  const selectGroup = [
-    CommandIDs.selectAll,
-    CommandIDs.deselectAll,
-  ].map(command => { return { command }; });
+    CommandIDs.pasteAndReplace
+  ].map(command => {
+    return { command };
+  });
 
-  const splitMergeGroup = [
-    CommandIDs.split,
-    CommandIDs.merge
-  ].map(command => { return { command }; });
+  const selectGroup = [CommandIDs.selectAll, CommandIDs.deselectAll].map(
+    command => {
+      return { command };
+    }
+  );
 
-  const moveCellsGroup = [
-    CommandIDs.moveUp,
-    CommandIDs.moveDown
-  ].map(command => { return { command }; });
+  const splitMergeGroup = [CommandIDs.split, CommandIDs.merge].map(command => {
+    return { command };
+  });
 
+  const moveCellsGroup = [CommandIDs.moveUp, CommandIDs.moveDown].map(
+    command => {
+      return { command };
+    }
+  );
 
   mainMenu.editMenu.addGroup(undoCellActionGroup, 4);
   mainMenu.editMenu.addGroup(copyGroup, 5);