Dave Willmer 9 年之前
父节点
当前提交
dd7cd18648

+ 2 - 2
src/about/plugin.ts

@@ -18,12 +18,12 @@ export
 const aboutExtension = {
   id: 'jupyter.extensions.about',
   activate: activateAbout
-}
+};
 
 
 function activateAbout(app: Application): void {
   let widget = new Widget();
-  let commandId = 'about-jupyterlab:show'
+  let commandId = 'about-jupyterlab:show';
   widget.id = 'about-jupyterlab';
   widget.title.text = 'About';
   widget.title.closable = true;

+ 2 - 25
src/documentmanager/plugin.ts

@@ -3,32 +3,9 @@
 'use strict';
 
 import {
-  IContentsModel
-} from 'jupyter-js-services';
-
-import {
-  AbstractFileHandler, DocumentManager
+  DocumentManager
 } from 'jupyter-js-ui/lib/docmanager';
 
-import {
-  FileBrowserWidget
-} from 'jupyter-js-ui/lib/filebrowser';
-
-import {
-  Application
-} from 'phosphide/lib/core/application';
-
-import * as arrays
- from 'phosphor-arrays';
-
-import {
-  Property
-} from 'phosphor-properties';
-
-import {
-  Widget
-} from 'phosphor-widget';
-
 
 /**
  * The class name added to document widgets.
@@ -52,5 +29,5 @@ const documentManagerProvider = {
   provides: DocumentManager,
   resolve: () => {
     return new DocumentManager();
-  },
+  }
 };

+ 5 - 5
src/filebrowser/plugin.ts

@@ -23,7 +23,7 @@ import {
 } from 'phosphor-properties';
 
 import {
-  Menu, MenuBar, MenuItem
+  Menu, MenuItem
 } from 'phosphor-menus';
 
 import {
@@ -78,11 +78,11 @@ function activateFileBrowser(app: Application, manager: DocumentManager, provide
     if (tabs instanceof TabPanel) {
       tabs.currentWidget = widget;
     }
-  }
+  };
 
   let onFileChanged = (args: IChangedArgs<string>) => {
     manager.rename(args.oldValue, args.newValue);
-  }
+  };
 
   model.openRequested.connect((bModel, model) => onOpenRequested(model));
   model.fileChanged.connect((mModel, args) => onFileChanged(args));
@@ -228,7 +228,7 @@ function activateFileBrowser(app: Application, manager: DocumentManager, provide
 
   widget.widgetFactory = model => {
     return manager.open(model);
-  }
+  };
 
   widget.title.text = 'Files';
   widget.id = 'file-browser';
@@ -309,6 +309,6 @@ function createMenu(fbWidget: FileBrowserWidget):  Menu {
       text: 'Shutdown Kernel',
       icon: 'fa fa-stop-circle-o',
       handler: () => { fbWidget.shutdownKernels(); }
-    }),
+    })
   ]);
 }

+ 2 - 6
src/filehandler/plugin.ts

@@ -3,17 +3,13 @@
 'use strict';
 
 import {
-  FileHandler, AbstractFileHandler, DocumentManager
+  FileHandler, DocumentManager
 } from 'jupyter-js-ui/lib/docmanager';
 
 import {
   Application
 } from 'phosphide/lib/core/application';
 
-import {
-  Widget
-} from 'phosphor-widget';
-
 import {
   JupyterServices
 } from '../services/plugin';
@@ -30,5 +26,5 @@ const fileHandlerExtension = {
     let handler = new FileHandler(services.contentsManager);
     manager.registerDefault(handler);
     return Promise.resolve(void 0);
-  },
+  }
 };

+ 1 - 5
src/help/plugin.ts

@@ -6,10 +6,6 @@ import {
   Application
 } from 'phosphide/lib/core/application';
 
-import {
-  Widget
-} from 'phosphor-widget';
-
 import {
   IFrame
 } from './iframe';
@@ -97,7 +93,7 @@ function activateHelpHandler(app: Application): Promise<void> {
     {
       id: 'help-doc:toggle',
       handler: toggleHelp
-    },
+    }
   ]);
 
   let helpPaletteItems = COMMANDS.map(command => {

+ 2 - 3
src/imagehandler/plugin.ts

@@ -34,7 +34,7 @@ const imageHandlerExtension = {
     let handler = new ImageHandler(services.contentsManager);
     manager.register(handler);
     return Promise.resolve(void 0);
-  },
+  }
 };
 
 
@@ -45,7 +45,7 @@ class ImageHandler extends AbstractFileHandler<Widget> {
    */
   get fileExtensions(): string[] {
     return ['.png', '.gif', '.jpeg', '.jpg', '.svg', '.bmp', '.ico', '.xbm',
-            '.tiff', '.tif']
+            '.tiff', '.tif'];
   }
 
   /**
@@ -66,7 +66,6 @@ class ImageHandler extends AbstractFileHandler<Widget> {
    * Create the widget from an `IContentsModel`.
    */
   protected createWidget(model: IContentsModel): Widget {
-    let ext = model.path.split('.').pop();
     var widget = new Widget();
     widget.node.tabIndex = 0;
     let image = document.createElement('img');

+ 3 - 7
src/main/plugin.ts

@@ -6,10 +6,6 @@ import {
   Application
 } from 'phosphide/lib/core/application';
 
-import {
-  Widget
-} from 'phosphor-widget';
-
 
 /**
  * The main extension.
@@ -19,9 +15,9 @@ const mainExtension = {
   id: 'jupyter.extensions.main',
   activate: (app: Application) => {
     window.onbeforeunload = event => {
-      let msg = 'Are you sure you want to exit JupyterLab?'
+      let msg = 'Are you sure you want to exit JupyterLab?';
       msg += '\nAny unsaved changes will be lost.';
       return msg;
-    }
+    };
   }
-}
+};

+ 35 - 39
src/notebook/plugin.ts

@@ -7,14 +7,10 @@ import {
   NotebookManager, NotebookToolbar
 } from 'jupyter-js-notebook';
 
-import {
-  isCodeCellModel, isMarkdownCellModel
-} from 'jupyter-js-notebook/lib/cells';
-
 import {
   IContentsModel, IContentsManager, IContentsOpts,
-  NotebookSessionManager, INotebookSessionManager,
-  INotebookSession, IKernelMessage, IComm, KernelStatus
+  INotebookSessionManager, INotebookSession,
+  IKernelMessage, IComm, KernelStatus
 } from 'jupyter-js-services';
 
 import {
@@ -34,7 +30,7 @@ import {
 } from 'phosphor-panel';
 
 import {
-  IChangedArgs, Property
+  IChangedArgs
 } from 'phosphor-properties';
 
 import {
@@ -71,7 +67,7 @@ const cmdIds = {
   selectNext: 'notebook-cells:select-next',
   editMode: 'notebook-cells:editMode',
   commandMode: 'notebook-cells:commandMode'
-}
+};
 
 
 /**
@@ -99,7 +95,7 @@ const notebookHandlerExtension = {
   id: 'jupyter.extensions.notebookHandler',
   requires: [DocumentManager, JupyterServices],
   activate: activateNotebookHandler
-}
+};
 
 
 /**
@@ -228,94 +224,94 @@ function activateNotebookHandler(app: Application, manager: DocumentManager, ser
       let model = handler.currentModel;
       if (model) model.mode = 'edit';
     }
-  },
+  }
   ]);
   app.palette.add([
   {
     command: cmdIds['run'],
     category: 'Notebook Cell Operations',
-    text: 'Run selected',
+    text: 'Run selected'
   },
   {
     command: cmdIds['runAndAdvance'],
     category: 'Notebook Cell Operations',
-    text: 'Run and Advance',
+    text: 'Run and Advance'
   },
   {
     command: cmdIds['runAndInsert'],
     category: 'Notebook Cell Operations',
-    text: 'Run and Insert',
+    text: 'Run and Insert'
   },
   {
     command: cmdIds['interrupt'],
     category: 'Notebook Operations',
-    text: 'Interrupt Kernel',
+    text: 'Interrupt Kernel'
   },
   {
     command: cmdIds['restart'],
     category: 'Notebook Operations',
-    text: 'Restart Kernel',
+    text: 'Restart Kernel'
   },
   {
     command: cmdIds['toCode'],
     category: 'Notebook Cell Operations',
-    text: 'Covert to Code',
+    text: 'Covert to Code'
   },
   {
     command: cmdIds['toMarkdown'],
     category: 'Notebook Cell Operations',
-    text: 'Covert to Markdown',
+    text: 'Covert to Markdown'
   },
   {
     command: cmdIds['toRaw'],
     category: 'Notebook Cell Operations',
-    text: 'Covert to Raw',
+    text: 'Covert to Raw'
   },
   {
     command: cmdIds['cut'],
     category: 'Notebook Cell Operations',
-    text: 'Cut selected',
+    text: 'Cut selected'
   },
   {
     command: cmdIds['copy'],
     category: 'Notebook Cell Operations',
-    text: 'Copy selected',
+    text: 'Copy selected'
   },
   {
     command: cmdIds['paste'],
     category: 'Notebook Cell Operations',
-    text: 'Paste cell(s)',
+    text: 'Paste cell(s)'
   },
   {
     command: cmdIds['insertAbove'],
     category: 'Notebook Cell Operations',
-    text: 'Insert cell above',
+    text: 'Insert cell above'
   },
   {
     command: cmdIds['insertBelow'],
     category: 'Notebook Cell Operations',
-    text: 'Insert cell below',
+    text: 'Insert cell below'
   },
   {
     command: cmdIds['selectPrevious'],
     category: 'Notebook Cell Operations',
-    text: 'Select previous cell',
+    text: 'Select previous cell'
   },
   {
     command: cmdIds['selectNext'],
     category: 'Notebook Cell Operations',
-    text: 'Select next cell',
+    text: 'Select next cell'
   },
   {
     command: cmdIds['editMode'],
     category: 'Notebook Cell Operations',
-    text: 'To Edit Mode',
+    text: 'To Edit Mode'
   },
   {
     command: cmdIds['commandMode'],
     category: 'Notebook Cell Operations',
-    text: 'To Command Mode',
-  },
+    text: 'To Command Mode'
+  }
   ]);
   return Promise.resolve(void 0);
 }
@@ -400,19 +396,19 @@ class NotebookPane extends Panel {
     let commHandler = (comm: IComm, msg: IKernelMessage) => {
       console.log('comm message', msg);
 
-      let modelPromise = manager.handle_comm_open(comm, msg);
+      manager.handle_comm_open(comm, msg);
 
-      comm.onMsg = (msg) => {
-        manager.handle_comm_open(comm, msg)
+      comm.onMsg = (message) => {
+        manager.handle_comm_open(comm, message);
         // create the widget model and (if needed) the view
-        console.log('comm widget message', msg);
-      }
-      comm.onClose = (msg) => {
-        console.log('comm widget close', msg);
-      }
+        console.log('comm widget message', message);
+      };
+      comm.onClose = (message) => {
+        console.log('comm widget close', message);
+      };
     };
 
-    this._session.kernel.registerCommTarget('ipython.widget', commHandler)
+    this._session.kernel.registerCommTarget('ipython.widget', commHandler);
     this._session.kernel.registerCommTarget('jupyter.widget', commHandler);
   }
 
@@ -438,7 +434,7 @@ class NotebookFileHandler extends AbstractFileHandler<NotebookPane> {
    * Get the list of file extensions supported by the handler.
    */
   get fileExtensions(): string[] {
-    return ['.ipynb']
+    return ['.ipynb'];
   }
 
   /**
@@ -485,7 +481,7 @@ class NotebookFileHandler extends AbstractFileHandler<NotebookPane> {
       host: widget.node
     }).then(result => {
       if (result.text === 'OK') {
-        return widget.session.shutdown()
+        return widget.session.shutdown();
       }
     }).then(() => {
       return super.close(widget);

+ 1 - 1
src/notebook/widgetmanager.ts

@@ -23,7 +23,7 @@ import 'jupyter-js-widgets/css/widgets.min.css';
 export
 class WidgetManager extends ManagerBase {
   constructor(panel: Panel) {
-    super()
+    super();
     this._panel = panel;
   }
 

+ 3 - 7
src/readonly-notebook/plugin.ts

@@ -3,13 +3,9 @@
 'use strict';
 
 import {
-  NotebookWidget, NotebookModel, serialize, deserialize, INotebookModel
+  NotebookWidget, NotebookModel, serialize, deserialize
 } from 'jupyter-js-notebook';
 
-import {
-  isCodeCellModel, isMarkdownCellModel
-} from 'jupyter-js-notebook/lib/cells';
-
 import {
   IContentsModel, IContentsManager, IContentsOpts
 } from 'jupyter-js-services';
@@ -36,7 +32,7 @@ const notebookHandlerExtension = {
   id: 'jupyter.extensions.notebookHandler',
   requires: [DocumentManager, JupyterServices],
   activate: activateNotebookHandler
-}
+};
 
 
 /**
@@ -64,7 +60,7 @@ class NotebookFileHandler extends AbstractFileHandler<NotebookWidget> {
    * Get the list of file extensions supported by the handler.
    */
   get fileExtensions(): string[] {
-    return ['.ipynb']
+    return ['.ipynb'];
   }
 
   /**

+ 1 - 1
src/services/plugin.ts

@@ -75,5 +75,5 @@ const servicesProvider = {
   provides: JupyterServices,
   resolve: () => {
     return new JupyterServices();
-  },
+  }
 };

+ 3 - 5
src/shortcuts/plugin.ts

@@ -95,17 +95,17 @@ const SHORTCUTS = [
     command: 'notebook-cells:to-code',
     selector: '.jp-Notebook.jp-mod-commandMode',
     sequence: ['Y']
-  }, 
+  },
   {
     command: 'notebook-cells:to-markdown',
     selector: '.jp-Notebook.jp-mod-commandMode',
     sequence: ['M']
-  }, 
+  },
   {
     command: 'notebook-cells:to-raw',
     selector: '.jp-Notebook.jp-mod-commandMode',
     sequence: ['R']
-  }, 
+  },
   {
     command: 'notebook-cells:cut',
     selector: '.jp-Notebook.jp-mod-commandMode',
@@ -165,5 +165,3 @@ const shortcutsExtension = {
     return Promise.resolve(void 0);
   }
 };
-
-

+ 2 - 2
src/terminal/plugin.ts

@@ -3,7 +3,7 @@
 'use strict';
 
 import {
-  TerminalWidget, ITerminalOptions
+  TerminalWidget
 } from 'jupyter-js-ui/lib/terminal';
 
 import {
@@ -16,7 +16,7 @@ import {
 
 
 /**
- * The default terminal extension. 
+ * The default terminal extension.
  */
 export
 const terminalExtension = {