@@ -11,6 +11,8 @@ import { IConsoleTracker } from '@jupyterlab/console';
11
11
12
12
import { INotebookTracker , NotebookPanel } from '@jupyterlab/notebook' ;
13
13
14
+ import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
15
+
14
16
import { listIcon } from '@jupyterlab/ui-components' ;
15
17
16
18
import { DummyHandler , VariableInspectionHandler } from './handler' ;
@@ -30,6 +32,9 @@ namespace CommandIDs {
30
32
export const open = 'variableinspector:open' ;
31
33
}
32
34
35
+ const SETTINGS_ID =
36
+ '@lckr/jupyterlab_variableinspector:jupyterlab-variableInspector-settings' ;
37
+
33
38
/**
34
39
* A service providing variable introspection.
35
40
*/
@@ -110,17 +115,24 @@ const variableinspector: JupyterFrontEndPlugin<IVariableInspectorManager> = {
110
115
*/
111
116
const consoles : JupyterFrontEndPlugin < void > = {
112
117
id : '@lckr/jupyterlab-variableinspector:consoles' ,
113
- requires : [ IVariableInspectorManager , IConsoleTracker , ILabShell ] ,
118
+ requires : [
119
+ IVariableInspectorManager ,
120
+ IConsoleTracker ,
121
+ ILabShell ,
122
+ ISettingRegistry
123
+ ] ,
114
124
autoStart : true ,
115
- activate : (
125
+ activate : async (
116
126
app : JupyterFrontEnd ,
117
127
manager : IVariableInspectorManager ,
118
128
consoles : IConsoleTracker ,
119
- labShell : ILabShell
120
- ) : void => {
129
+ labShell : ILabShell ,
130
+ settings : ISettingRegistry
131
+ ) : Promise < void > => {
121
132
const handlers : {
122
133
[ id : string ] : Promise < IVariableInspector . IInspectable > ;
123
134
} = { } ;
135
+ const setting = await settings . load ( SETTINGS_ID ) ;
124
136
125
137
/**
126
138
* 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> = {
150
162
const matrixQueryCommand = result . matrixQueryCommand ;
151
163
const widgetQueryCommand = result . widgetQueryCommand ;
152
164
const deleteCommand = result . deleteCommand ;
165
+ const changeSettingsCommand = result . changeSettingsCommand ;
153
166
154
167
const options : VariableInspectionHandler . IOptions = {
155
- queryCommand : queryCommand ,
156
- matrixQueryCommand : matrixQueryCommand ,
168
+ queryCommand,
169
+ matrixQueryCommand,
157
170
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
162
177
} ;
163
178
const handler = new VariableInspectionHandler ( options ) ;
164
179
manager . addHandler ( handler ) ;
@@ -222,15 +237,22 @@ const consoles: JupyterFrontEndPlugin<void> = {
222
237
*/
223
238
const notebooks : JupyterFrontEndPlugin < void > = {
224
239
id : '@lckr/jupyterlab-variableinspector:notebooks' ,
225
- requires : [ IVariableInspectorManager , INotebookTracker , ILabShell ] ,
240
+ requires : [
241
+ IVariableInspectorManager ,
242
+ INotebookTracker ,
243
+ ILabShell ,
244
+ ISettingRegistry
245
+ ] ,
226
246
autoStart : true ,
227
- activate : (
247
+ activate : async (
228
248
app : JupyterFrontEnd ,
229
249
manager : IVariableInspectorManager ,
230
250
notebooks : INotebookTracker ,
231
- labShell : ILabShell
232
- ) : void => {
251
+ labShell : ILabShell ,
252
+ settings : ISettingRegistry
253
+ ) : Promise < void > => {
233
254
const handlers : { [ id : string ] : Promise < VariableInspectionHandler > } = { } ;
255
+ const setting = await settings . load ( SETTINGS_ID ) ;
234
256
235
257
/**
236
258
* 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> = {
256
278
const matrixQueryCommand = result . matrixQueryCommand ;
257
279
const widgetQueryCommand = result . widgetQueryCommand ;
258
280
const deleteCommand = result . deleteCommand ;
281
+ const changeSettingsCommand = result . changeSettingsCommand ;
259
282
260
283
const options : VariableInspectionHandler . IOptions = {
261
- queryCommand : queryCommand ,
262
- matrixQueryCommand : matrixQueryCommand ,
284
+ queryCommand,
285
+ matrixQueryCommand,
263
286
widgetQueryCommand,
264
- deleteCommand : deleteCommand ,
265
- connector : connector ,
287
+ deleteCommand,
288
+ connector,
266
289
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
269
294
} ;
270
295
const handler = new VariableInspectionHandler ( options ) ;
271
296
manager . addHandler ( handler ) ;
0 commit comments