@@ -11,6 +11,8 @@ import { IConsoleTracker } from '@jupyterlab/console';
1111
1212import { INotebookTracker , NotebookPanel } from '@jupyterlab/notebook' ;
1313
14+ import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
15+
1416import { listIcon } from '@jupyterlab/ui-components' ;
1517
1618import { DummyHandler , VariableInspectionHandler } from './handler' ;
@@ -30,6 +32,9 @@ namespace CommandIDs {
3032 export const open = 'variableinspector:open' ;
3133}
3234
35+ const SETTINGS_ID =
36+ '@lckr/jupyterlab_variableinspector:jupyterlab-variableInspector-settings' ;
37+
3338/**
3439 * A service providing variable introspection.
3540 */
@@ -110,17 +115,24 @@ const variableinspector: JupyterFrontEndPlugin<IVariableInspectorManager> = {
110115 */
111116const consoles : JupyterFrontEndPlugin < void > = {
112117 id : '@lckr/jupyterlab-variableinspector:consoles' ,
113- requires : [ IVariableInspectorManager , IConsoleTracker , ILabShell ] ,
118+ requires : [
119+ IVariableInspectorManager ,
120+ IConsoleTracker ,
121+ ILabShell ,
122+ ISettingRegistry
123+ ] ,
114124 autoStart : true ,
115- activate : (
125+ activate : async (
116126 app : JupyterFrontEnd ,
117127 manager : IVariableInspectorManager ,
118128 consoles : IConsoleTracker ,
119- labShell : ILabShell
120- ) : void => {
129+ labShell : ILabShell ,
130+ settings : ISettingRegistry
131+ ) : Promise < void > => {
121132 const handlers : {
122133 [ id : string ] : Promise < IVariableInspector . IInspectable > ;
123134 } = { } ;
135+ const setting = await settings . load ( SETTINGS_ID ) ;
124136
125137 /**
126138 * Subscribes to the creation of new consoles. If a new notebook is created, build a new handler for the consoles.
@@ -150,15 +162,18 @@ const consoles: JupyterFrontEndPlugin<void> = {
150162 const matrixQueryCommand = result . matrixQueryCommand ;
151163 const widgetQueryCommand = result . widgetQueryCommand ;
152164 const deleteCommand = result . deleteCommand ;
165+ const changeSettingsCommand = result . changeSettingsCommand ;
153166
154167 const options : VariableInspectionHandler . IOptions = {
155- queryCommand : queryCommand ,
156- matrixQueryCommand : matrixQueryCommand ,
168+ queryCommand,
169+ matrixQueryCommand,
157170 widgetQueryCommand,
158- deleteCommand : deleteCommand ,
159- connector : connector ,
160- initScript : initScript ,
161- id : session . path //Using the sessions path as an identifier for now.
171+ deleteCommand,
172+ connector,
173+ initScript,
174+ changeSettingsCommand,
175+ id : session . path , //Using the sessions path as an identifier for now.
176+ setting
162177 } ;
163178 const handler = new VariableInspectionHandler ( options ) ;
164179 manager . addHandler ( handler ) ;
@@ -222,15 +237,22 @@ const consoles: JupyterFrontEndPlugin<void> = {
222237 */
223238const notebooks : JupyterFrontEndPlugin < void > = {
224239 id : '@lckr/jupyterlab-variableinspector:notebooks' ,
225- requires : [ IVariableInspectorManager , INotebookTracker , ILabShell ] ,
240+ requires : [
241+ IVariableInspectorManager ,
242+ INotebookTracker ,
243+ ILabShell ,
244+ ISettingRegistry
245+ ] ,
226246 autoStart : true ,
227- activate : (
247+ activate : async (
228248 app : JupyterFrontEnd ,
229249 manager : IVariableInspectorManager ,
230250 notebooks : INotebookTracker ,
231- labShell : ILabShell
232- ) : void => {
251+ labShell : ILabShell ,
252+ settings : ISettingRegistry
253+ ) : Promise < void > => {
233254 const handlers : { [ id : string ] : Promise < VariableInspectionHandler > } = { } ;
255+ const setting = await settings . load ( SETTINGS_ID ) ;
234256
235257 /**
236258 * Subscribes to the creation of new notebooks. If a new notebook is created, build a new handler for the notebook.
@@ -256,16 +278,19 @@ const notebooks: JupyterFrontEndPlugin<void> = {
256278 const matrixQueryCommand = result . matrixQueryCommand ;
257279 const widgetQueryCommand = result . widgetQueryCommand ;
258280 const deleteCommand = result . deleteCommand ;
281+ const changeSettingsCommand = result . changeSettingsCommand ;
259282
260283 const options : VariableInspectionHandler . IOptions = {
261- queryCommand : queryCommand ,
262- matrixQueryCommand : matrixQueryCommand ,
284+ queryCommand,
285+ matrixQueryCommand,
263286 widgetQueryCommand,
264- deleteCommand : deleteCommand ,
265- connector : connector ,
287+ deleteCommand,
288+ connector,
266289 rendermime,
267- initScript : initScript ,
268- id : session . path //Using the sessions path as an identifier for now.
290+ initScript,
291+ changeSettingsCommand,
292+ id : session . path , //Using the sessions path as an identifier for now.
293+ setting
269294 } ;
270295 const handler = new VariableInspectionHandler ( options ) ;
271296 manager . addHandler ( handler ) ;
0 commit comments