11import {
22 JupyterFrontEnd ,
3- JupyterFrontEndPlugin
3+ JupyterFrontEndPlugin ,
4+ ILabShell ,
45} from '@jupyterlab/application' ;
56
7+ import { ICommandPalette } from '@jupyterlab/apputils' ;
8+ import { createEmptyVariableInspectorPanel } from './components/variableInspectorPanel' ;
69import { createVariableInspectorSidebar } from './components/variableInspectorSidebar' ;
710import { NotebookWatcher } from './watchers/notebookWatcher' ;
811
12+
913const leftTab : JupyterFrontEndPlugin < void > = {
1014 id : 'package-manager:plugin' ,
1115 description : 'A JupyterLab extension to list, remove and install python packages from pip.' ,
@@ -16,11 +20,29 @@ const leftTab: JupyterFrontEndPlugin<void> = {
1620
1721 notebookWatcher . selectionChanged . connect ( ( sender , selections ) => { } ) ;
1822
19- let widget = createVariableInspectorSidebar ( notebookWatcher ) ;
23+ let widget = createVariableInspectorSidebar ( notebookWatcher , app . commands ) ;
2024
2125 app . shell . add ( widget , 'left' , { rank : 1999 } ) ;
2226 }
2327} ;
2428
25- export default leftTab ;
29+
30+ const customVariableInspectorPlugin : JupyterFrontEndPlugin < void > = {
31+ id : 'custom-variableinspector' ,
32+ autoStart : true ,
33+ requires : [ ICommandPalette , ILabShell ] ,
34+ activate : ( app : JupyterFrontEnd , palette : ICommandPalette , labShell : ILabShell ) => {
35+ const command = 'custom:open-variable-inspector' ;
36+ app . commands . addCommand ( command , {
37+ label : 'Open Custom Variable Inspector' ,
38+ execute : ( ) => {
39+ createEmptyVariableInspectorPanel ( labShell ) ;
40+ }
41+ } ) ;
42+
43+ palette . addItem ( { command, category : 'Custom Extensions' } ) ;
44+ }
45+ } ;
46+
47+ export default [ customVariableInspectorPlugin , leftTab ] ;
2648
0 commit comments