@jupyterlab/debugger 4.0.0-alpha.9 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/debugger.d.ts +3 -1
  2. package/lib/debugger.js +5 -3
  3. package/lib/debugger.js.map +1 -1
  4. package/lib/dialogs/evaluate.d.ts +5 -0
  5. package/lib/dialogs/evaluate.js +16 -6
  6. package/lib/dialogs/evaluate.js.map +1 -1
  7. package/lib/factory.d.ts +1 -1
  8. package/lib/factory.js +15 -9
  9. package/lib/factory.js.map +1 -1
  10. package/lib/handler.js +15 -7
  11. package/lib/handler.js.map +1 -1
  12. package/lib/handlers/console.js +9 -3
  13. package/lib/handlers/console.js.map +1 -1
  14. package/lib/handlers/editor.d.ts +26 -12
  15. package/lib/handlers/editor.js +166 -89
  16. package/lib/handlers/editor.js.map +1 -1
  17. package/lib/handlers/file.js +6 -2
  18. package/lib/handlers/file.js.map +1 -1
  19. package/lib/handlers/notebook.d.ts +0 -7
  20. package/lib/handlers/notebook.js +11 -17
  21. package/lib/handlers/notebook.js.map +1 -1
  22. package/lib/icons.d.ts +2 -1
  23. package/lib/icons.js +6 -1
  24. package/lib/icons.js.map +1 -1
  25. package/lib/model.js +1 -0
  26. package/lib/model.js.map +1 -1
  27. package/lib/panels/breakpoints/index.d.ts +2 -2
  28. package/lib/panels/breakpoints/index.js +9 -7
  29. package/lib/panels/breakpoints/index.js.map +1 -1
  30. package/lib/panels/breakpoints/pauseonexceptions.d.ts +53 -0
  31. package/lib/panels/breakpoints/pauseonexceptions.js +98 -0
  32. package/lib/panels/breakpoints/pauseonexceptions.js.map +1 -0
  33. package/lib/panels/callstack/index.d.ts +1 -1
  34. package/lib/panels/kernelSources/body.d.ts +5 -7
  35. package/lib/panels/kernelSources/body.js +37 -47
  36. package/lib/panels/kernelSources/body.js.map +1 -1
  37. package/lib/panels/kernelSources/filter.d.ts +1 -2
  38. package/lib/panels/kernelSources/filter.js +2 -2
  39. package/lib/panels/kernelSources/filter.js.map +1 -1
  40. package/lib/panels/kernelSources/index.js +1 -1
  41. package/lib/panels/kernelSources/index.js.map +1 -1
  42. package/lib/panels/kernelSources/model.d.ts +10 -1
  43. package/lib/panels/kernelSources/model.js +19 -1
  44. package/lib/panels/kernelSources/model.js.map +1 -1
  45. package/lib/panels/sources/body.js +5 -3
  46. package/lib/panels/sources/body.js.map +1 -1
  47. package/lib/panels/sources/sourcepath.js +1 -1
  48. package/lib/panels/sources/sourcepath.js.map +1 -1
  49. package/lib/panels/variables/grid.d.ts +23 -10
  50. package/lib/panels/variables/grid.js +42 -367
  51. package/lib/panels/variables/grid.js.map +1 -1
  52. package/lib/panels/variables/gridpanel.d.ts +138 -0
  53. package/lib/panels/variables/gridpanel.js +362 -0
  54. package/lib/panels/variables/gridpanel.js.map +1 -0
  55. package/lib/panels/variables/mimerenderer.js +9 -1
  56. package/lib/panels/variables/mimerenderer.js.map +1 -1
  57. package/lib/panels/variables/scope.js +4 -0
  58. package/lib/panels/variables/scope.js.map +1 -1
  59. package/lib/panels/variables/tree.d.ts +1 -0
  60. package/lib/panels/variables/tree.js +136 -47
  61. package/lib/panels/variables/tree.js.map +1 -1
  62. package/lib/service.d.ts +20 -6
  63. package/lib/service.js +84 -59
  64. package/lib/service.js.map +1 -1
  65. package/lib/session.d.ts +20 -6
  66. package/lib/session.js +59 -11
  67. package/lib/session.js.map +1 -1
  68. package/lib/sidebar.js +1 -1
  69. package/lib/sources.d.ts +2 -2
  70. package/lib/sources.js +32 -17
  71. package/lib/sources.js.map +1 -1
  72. package/lib/tokens.d.ts +57 -13
  73. package/lib/tokens.js.map +1 -1
  74. package/package.json +38 -46
  75. package/src/config.ts +78 -0
  76. package/src/debugger.ts +154 -0
  77. package/src/dialogs/evaluate.ts +144 -0
  78. package/src/factory.ts +72 -0
  79. package/src/handler.ts +528 -0
  80. package/src/handlers/console.ts +118 -0
  81. package/src/handlers/editor.ts +469 -0
  82. package/src/handlers/file.ts +86 -0
  83. package/src/handlers/notebook.ts +128 -0
  84. package/src/hash.ts +69 -0
  85. package/src/icons.ts +64 -0
  86. package/src/index.ts +16 -0
  87. package/src/model.ts +155 -0
  88. package/src/panels/breakpoints/body.tsx +145 -0
  89. package/src/panels/breakpoints/index.ts +116 -0
  90. package/src/panels/breakpoints/model.ts +74 -0
  91. package/src/panels/breakpoints/pauseonexceptions.tsx +141 -0
  92. package/src/panels/callstack/body.tsx +96 -0
  93. package/src/panels/callstack/index.ts +152 -0
  94. package/src/panels/callstack/model.ts +86 -0
  95. package/src/panels/kernelSources/body.tsx +139 -0
  96. package/src/panels/kernelSources/filter.tsx +44 -0
  97. package/src/panels/kernelSources/index.tsx +106 -0
  98. package/src/panels/kernelSources/model.ts +160 -0
  99. package/src/panels/sources/body.ts +161 -0
  100. package/src/panels/sources/index.tsx +85 -0
  101. package/src/panels/sources/model.ts +94 -0
  102. package/src/panels/sources/sourcepath.tsx +31 -0
  103. package/src/panels/variables/grid.ts +145 -0
  104. package/src/panels/variables/gridpanel.ts +453 -0
  105. package/src/panels/variables/index.ts +199 -0
  106. package/src/panels/variables/mimerenderer.ts +125 -0
  107. package/src/panels/variables/model.ts +61 -0
  108. package/src/panels/variables/scope.tsx +132 -0
  109. package/src/panels/variables/tree.tsx +521 -0
  110. package/src/service.ts +1009 -0
  111. package/src/session.ts +342 -0
  112. package/src/sidebar.ts +194 -0
  113. package/src/sources.ts +327 -0
  114. package/src/svg.d.ts +9 -0
  115. package/src/tokens.ts +1071 -0
  116. package/style/breakpoints.css +21 -12
  117. package/style/callstack.css +2 -2
  118. package/style/icons/exceptions.svg +10 -0
  119. package/style/index.css +1 -1
  120. package/style/index.js +1 -1
  121. package/style/kernelSources.css +3 -9
  122. package/style/sources.css +1 -1
  123. package/style/variables.css +68 -21
package/src/tokens.ts ADDED
@@ -0,0 +1,1071 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+
4
+ import { CodeEditor, CodeEditorWrapper } from '@jupyterlab/codeeditor';
5
+
6
+ import { KernelMessage, Session } from '@jupyterlab/services';
7
+
8
+ import { ISharedText } from '@jupyter/ydoc';
9
+
10
+ import { ReadonlyJSONObject, Token } from '@lumino/coreutils';
11
+
12
+ import { IDisposable, IObservableDisposable } from '@lumino/disposable';
13
+
14
+ import { ISignal, Signal } from '@lumino/signaling';
15
+
16
+ import { Panel } from '@lumino/widgets';
17
+
18
+ import { DebugProtocol } from '@vscode/debugprotocol';
19
+
20
+ import { DebuggerHandler } from './handler';
21
+
22
+ /**
23
+ * An interface describing an application's visual debugger.
24
+ */
25
+ export interface IDebugger {
26
+ /**
27
+ * Signal emitted for debug event messages.
28
+ */
29
+ readonly eventMessage: ISignal<IDebugger, IDebugger.ISession.Event>;
30
+
31
+ /**
32
+ * Whether the current debugger is started.
33
+ */
34
+ readonly isStarted: boolean;
35
+
36
+ /**
37
+ * Get debugger config.
38
+ */
39
+ readonly config: IDebugger.IConfig;
40
+
41
+ /**
42
+ * A signal emitted when the pause on exception filter changes.
43
+ */
44
+ readonly pauseOnExceptionChanged: Signal<IDebugger, void>;
45
+
46
+ /**
47
+ * The debugger service's model.
48
+ */
49
+ readonly model: IDebugger.Model.IService;
50
+
51
+ /**
52
+ * The current debugger session.
53
+ */
54
+ session: IDebugger.ISession | null;
55
+
56
+ /**
57
+ * Signal emitted upon session changed.
58
+ */
59
+ readonly sessionChanged: ISignal<IDebugger, IDebugger.ISession | null>;
60
+
61
+ /**
62
+ * Removes all the breakpoints from the current notebook or console
63
+ */
64
+ clearBreakpoints(): Promise<void>;
65
+
66
+ /**
67
+ * Used to determine if kernel has pause on exception capabilities
68
+ */
69
+ pauseOnExceptionsIsValid(): boolean;
70
+
71
+ /**
72
+ * Add a filter to pauseOnExceptionsFilter.
73
+ *
74
+ * @param exceptionFilter - filter name.
75
+ */
76
+ pauseOnExceptionsFilter(exceptionFilter: string): Promise<void>;
77
+
78
+ /**
79
+ * Send the pauseOnExceptions' filters to the debugger.
80
+ */
81
+ pauseOnExceptions(exceptionFilter: string[]): Promise<void>;
82
+
83
+ /**
84
+ * Continues the execution of the current thread.
85
+ */
86
+ continue(): Promise<void>;
87
+
88
+ /**
89
+ * Evaluate an expression.
90
+ */
91
+ evaluate(
92
+ expression: string
93
+ ): Promise<DebugProtocol.EvaluateResponse['body'] | null>;
94
+
95
+ /**
96
+ * Computes an id based on the given code.
97
+ */
98
+ getCodeId(code: string): string;
99
+
100
+ /**
101
+ * Retrieve the content of a source file.
102
+ *
103
+ * @param source The source object containing the path to the file.
104
+ */
105
+ getSource(source: DebugProtocol.Source): Promise<IDebugger.Source>;
106
+
107
+ /**
108
+ * Whether there exist a thread in stopped state.
109
+ */
110
+ hasStoppedThreads(): boolean;
111
+
112
+ /**
113
+ * Request variables for a given variable reference.
114
+ *
115
+ * @param variablesReference The variable reference to request.
116
+ */
117
+ inspectVariable(
118
+ variablesReference: number
119
+ ): Promise<DebugProtocol.Variable[]>;
120
+
121
+ /**
122
+ * Request rich representation of a variable.
123
+ *
124
+ * @param variableName The variable name to request
125
+ * @param frameId The current frame id in which to request the variable
126
+ * @returns The mime renderer data model
127
+ */
128
+ inspectRichVariable(
129
+ variableName: string,
130
+ frameId?: number
131
+ ): Promise<IDebugger.IRichVariable>;
132
+
133
+ /**
134
+ * Requests all the defined variables and display them in the
135
+ * table view.
136
+ */
137
+ displayDefinedVariables(): Promise<void>;
138
+
139
+ /**
140
+ * Requests all the loaded modules and display them.
141
+ */
142
+ displayModules(): Promise<void>;
143
+
144
+ /**
145
+ * Request whether debugging is available for the given session connection.
146
+ *
147
+ * @param connection The session connection.
148
+ */
149
+ isAvailable(connection: Session.ISessionConnection): Promise<boolean>;
150
+
151
+ /**
152
+ * Makes the current thread run again for one step.
153
+ */
154
+ next(): Promise<void>;
155
+
156
+ /**
157
+ * Restart the debugger.
158
+ * Precondition: isStarted
159
+ */
160
+ restart(): Promise<void>;
161
+
162
+ /**
163
+ * Restore the state of a debug session.
164
+ *
165
+ * @param autoStart - when true, starts the debugger
166
+ * if it has not been started yet.
167
+ */
168
+ restoreState(autoStart: boolean): Promise<void>;
169
+
170
+ /**
171
+ * Starts a debugger.
172
+ * Precondition: !isStarted
173
+ */
174
+ start(): Promise<void>;
175
+
176
+ /**
177
+ * Makes the current thread pause if possible.
178
+ */
179
+ pause(): Promise<void>;
180
+
181
+ /**
182
+ * Makes the current thread step in a function / method if possible.
183
+ */
184
+ stepIn(): Promise<void>;
185
+
186
+ /**
187
+ * Makes the current thread step out a function / method if possible.
188
+ */
189
+ stepOut(): Promise<void>;
190
+
191
+ /**
192
+ * Stops the debugger.
193
+ * Precondition: isStarted
194
+ */
195
+ stop(): Promise<void>;
196
+
197
+ /**
198
+ * Update all breakpoints of a cell at once.
199
+ *
200
+ * @param code - The code in the cell where the breakpoints are set.
201
+ * @param breakpoints - The list of breakpoints to set.
202
+ * @param path - Optional path to the file where to set the breakpoints.
203
+ */
204
+ updateBreakpoints(
205
+ code: string,
206
+ breakpoints: IDebugger.IBreakpoint[],
207
+ path?: string
208
+ ): Promise<void>;
209
+
210
+ /**
211
+ * Get the debugger state
212
+ *
213
+ * @returns Debugger state
214
+ */
215
+ getDebuggerState(): IDebugger.State;
216
+
217
+ /**
218
+ * Restore the debugger state
219
+ *
220
+ * @param state Debugger state
221
+ * @returns Whether the state has been restored successfully or not
222
+ */
223
+ restoreDebuggerState(state: IDebugger.State): Promise<boolean>;
224
+ }
225
+
226
+ /**
227
+ * A namespace for visual debugger types.
228
+ */
229
+ export namespace IDebugger {
230
+ /**
231
+ * The type for a source file.
232
+ */
233
+ export type Source = {
234
+ /**
235
+ * The content of the source.
236
+ */
237
+ content: string;
238
+
239
+ /**
240
+ * The mimeType of the source.
241
+ */
242
+ mimeType?: string;
243
+
244
+ /**
245
+ * The path of the source.
246
+ */
247
+ path: string;
248
+ };
249
+
250
+ /**
251
+ * The type for a kernel source file.
252
+ */
253
+ export type KernelSource = {
254
+ /**
255
+ * The name of the source.
256
+ */
257
+ name: string;
258
+
259
+ /**
260
+ * The path of the source.
261
+ */
262
+ path: string;
263
+ };
264
+
265
+ /**
266
+ * Single breakpoint in an editor.
267
+ */
268
+ export interface IBreakpoint extends DebugProtocol.Breakpoint {}
269
+
270
+ /*
271
+ * The state of the debugger, used for restoring a debugging session
272
+ * after restarting the kernel.
273
+ */
274
+ export type State = {
275
+ /**
276
+ * List of cells to dump after the kernel has restarted
277
+ */
278
+ cells: string[];
279
+ /**
280
+ * Map of breakpoints to send back to the kernel after it has restarted
281
+ */
282
+ breakpoints: Map<string, IDebugger.IBreakpoint[]>;
283
+ };
284
+
285
+ /**
286
+ * Debugger file and hashing configuration.
287
+ */
288
+ export interface IConfig {
289
+ /**
290
+ * Returns an id based on the given code.
291
+ *
292
+ * @param code The source code.
293
+ * @param kernel The kernel name from current session.
294
+ */
295
+ getCodeId(code: string, kernel: string): string;
296
+
297
+ /**
298
+ * Sets the hash parameters for a kernel.
299
+ *
300
+ * @param params - Hashing parameters for a kernel.
301
+ */
302
+ setHashParams(params: IConfig.HashParams): void;
303
+
304
+ /**
305
+ * Sets the parameters used for the temp files (e.g. cells) for a kernel.
306
+ *
307
+ * @param params - Temporary file prefix and suffix for a kernel.
308
+ */
309
+ setTmpFileParams(params: IConfig.FileParams): void;
310
+
311
+ /**
312
+ * Gets the parameters used for the temp files (e.e. cells) for a kernel.
313
+ *
314
+ * @param kernel - The kernel name from current session.
315
+ */
316
+ getTmpFileParams(kernel: string): IConfig.FileParams;
317
+ }
318
+
319
+ /**
320
+ * An interface for debugger handler.
321
+ */
322
+ export interface IHandler extends DebuggerHandler.IHandler {}
323
+
324
+ /**
325
+ * An interface for a scope.
326
+ */
327
+ export interface IScope {
328
+ /**
329
+ * The name of the scope.
330
+ */
331
+ name: string;
332
+
333
+ /**
334
+ * The list of variables.
335
+ */
336
+ variables: IVariable[];
337
+ }
338
+
339
+ /**
340
+ * A visual debugger session.
341
+ */
342
+ export interface ISession extends IObservableDisposable {
343
+ /**
344
+ * The API session connection to connect to a debugger.
345
+ */
346
+ connection: Session.ISessionConnection | null;
347
+
348
+ /**
349
+ * Returns the initialize response.
350
+ */
351
+ readonly capabilities: DebugProtocol.Capabilities | undefined;
352
+
353
+ /**
354
+ * Whether the debug session is started.
355
+ */
356
+ readonly isStarted: boolean;
357
+
358
+ /**
359
+ * Whether the debug session is pausing on exceptions.
360
+ */
361
+ exceptionPaths: string[];
362
+
363
+ /**
364
+ * Get exception filters and default values.
365
+ */
366
+ exceptionBreakpointFilters:
367
+ | DebugProtocol.ExceptionBreakpointsFilter[]
368
+ | undefined;
369
+
370
+ /**
371
+ * Signal emitted for debug event messages.
372
+ */
373
+ readonly eventMessage: ISignal<
374
+ IDebugger.ISession,
375
+ IDebugger.ISession.Event
376
+ >;
377
+
378
+ /**
379
+ * Get current exception filter.
380
+ */
381
+ currentExceptionFilters: string[];
382
+
383
+ /**
384
+ * Whether the debugger is pausing on exception.
385
+ *
386
+ * @param filter - Specify a filter
387
+ */
388
+ isPausingOnException(filter?: string): boolean;
389
+
390
+ /**
391
+ * Restore the state of a debug session.
392
+ */
393
+ restoreState(): Promise<IDebugger.ISession.Response['debugInfo']>;
394
+
395
+ /**
396
+ * Send a debug request to the kernel.
397
+ */
398
+ sendRequest<K extends keyof IDebugger.ISession.Request>(
399
+ command: K,
400
+ args: IDebugger.ISession.Request[K]
401
+ ): Promise<IDebugger.ISession.Response[K]>;
402
+
403
+ /**
404
+ * Start a new debug session.
405
+ */
406
+ start(): Promise<void>;
407
+
408
+ /**
409
+ * Stop a running debug session.
410
+ */
411
+ stop(): Promise<void>;
412
+ }
413
+
414
+ /**
415
+ * A utility to find text editors used by the debugger.
416
+ */
417
+ export interface ISources {
418
+ /**
419
+ * Returns an array of editors for a source matching the current debug
420
+ * session by iterating through all the widgets in each of the supported
421
+ * debugger types (i.e., consoles, files, notebooks).
422
+ *
423
+ * @param params - The editor find parameters.
424
+ */
425
+ find(params: ISources.FindParams): ISources.IEditor[];
426
+
427
+ /**
428
+ * Open a read-only editor in the main area.
429
+ *
430
+ * @param params - The editor open parameters.
431
+ */
432
+ open(params: ISources.OpenParams): void;
433
+ }
434
+
435
+ /**
436
+ * The type for a stack frame
437
+ */
438
+ export interface IStackFrame extends DebugProtocol.StackFrame {}
439
+
440
+ /**
441
+ * A reply to an rich inspection request.
442
+ */
443
+ export interface IRichVariable {
444
+ /**
445
+ * The MIME bundle data returned from an rich inspection request.
446
+ */
447
+ data: ReadonlyJSONObject;
448
+
449
+ /**
450
+ * Any metadata that accompanies the MIME bundle returning from a rich inspection request.
451
+ */
452
+ metadata: ReadonlyJSONObject;
453
+ }
454
+
455
+ /**
456
+ * An interface for a variable.
457
+ */
458
+ export interface IVariable extends DebugProtocol.Variable {
459
+ /**
460
+ * Whether the variable is expanded.
461
+ */
462
+ expanded?: boolean;
463
+ }
464
+
465
+ /**
466
+ * Debugger file and hashing configuration.
467
+ */
468
+ export namespace IConfig {
469
+ /**
470
+ * Temporary file prefix and suffix for a kernel.
471
+ */
472
+ export type FileParams = {
473
+ /**
474
+ * The kernel name.
475
+ */
476
+ kernel: string;
477
+
478
+ /**
479
+ * Prefix added to temporary files created by the kernel per cell.
480
+ */
481
+ prefix: string;
482
+
483
+ /**
484
+ * Suffix added temporary files created by the kernel per cell.
485
+ */
486
+ suffix: string;
487
+ };
488
+
489
+ /**
490
+ * Hashing parameters for a kernel.
491
+ */
492
+ export type HashParams = {
493
+ /**
494
+ * The kernel name.
495
+ */
496
+ kernel: string;
497
+
498
+ /**
499
+ * The hashing method.
500
+ */
501
+ method: string;
502
+
503
+ /**
504
+ * An optional hashing seed provided by the kernel.
505
+ */
506
+ seed?: any;
507
+ };
508
+ }
509
+
510
+ export namespace ISession {
511
+ /**
512
+ * A generic debug event.
513
+ */
514
+ export type Event = DebugProtocol.Event;
515
+
516
+ /**
517
+ * Expose all the debug requests types.
518
+ */
519
+ export type Request = {
520
+ attach: DebugProtocol.AttachRequestArguments;
521
+ completions: DebugProtocol.CompletionsArguments;
522
+ configurationDone: DebugProtocol.ConfigurationDoneArguments;
523
+ continue: DebugProtocol.ContinueArguments;
524
+ debugInfo: Record<string, never>;
525
+ disconnect: DebugProtocol.DisconnectArguments;
526
+ dumpCell: IDumpCellArguments;
527
+ evaluate: DebugProtocol.EvaluateArguments;
528
+ exceptionInfo: DebugProtocol.ExceptionInfoArguments;
529
+ goto: DebugProtocol.GotoArguments;
530
+ gotoTargets: DebugProtocol.GotoTargetsArguments;
531
+ initialize: DebugProtocol.InitializeRequestArguments;
532
+ inspectVariables: Record<string, never>;
533
+ launch: DebugProtocol.LaunchRequestArguments;
534
+ loadedSources: DebugProtocol.LoadedSourcesArguments;
535
+ modules: DebugProtocol.ModulesArguments;
536
+ next: DebugProtocol.NextArguments;
537
+ pause: DebugProtocol.PauseArguments;
538
+ restart: DebugProtocol.RestartArguments;
539
+ restartFrame: DebugProtocol.RestartFrameArguments;
540
+ reverseContinue: DebugProtocol.ReverseContinueArguments;
541
+ richInspectVariables: IRichVariablesArguments;
542
+ scopes: DebugProtocol.ScopesArguments;
543
+ setBreakpoints: DebugProtocol.SetBreakpointsArguments;
544
+ setExceptionBreakpoints: DebugProtocol.SetExceptionBreakpointsArguments;
545
+ setExpression: DebugProtocol.SetExpressionArguments;
546
+ setFunctionBreakpoints: DebugProtocol.SetFunctionBreakpointsArguments;
547
+ setVariable: DebugProtocol.SetVariableArguments;
548
+ source: DebugProtocol.SourceArguments;
549
+ stackTrace: DebugProtocol.StackTraceArguments;
550
+ stepBack: DebugProtocol.StepBackArguments;
551
+ stepIn: DebugProtocol.StepInArguments;
552
+ stepInTargets: DebugProtocol.StepInTargetsArguments;
553
+ stepOut: DebugProtocol.StepOutArguments;
554
+ terminate: DebugProtocol.TerminateArguments;
555
+ terminateThreads: DebugProtocol.TerminateThreadsArguments;
556
+ threads: Record<string, never>;
557
+ variables: DebugProtocol.VariablesArguments;
558
+ };
559
+
560
+ /**
561
+ * Expose all the debug response types.
562
+ */
563
+ export type Response = {
564
+ attach: DebugProtocol.AttachResponse;
565
+ completions: DebugProtocol.CompletionsResponse;
566
+ configurationDone: DebugProtocol.ConfigurationDoneResponse;
567
+ continue: DebugProtocol.ContinueResponse;
568
+ debugInfo: IDebugInfoResponse;
569
+ disconnect: DebugProtocol.DisconnectResponse;
570
+ dumpCell: IDumpCellResponse;
571
+ evaluate: DebugProtocol.EvaluateResponse;
572
+ exceptionInfo: DebugProtocol.ExceptionInfoResponse;
573
+ goto: DebugProtocol.GotoResponse;
574
+ gotoTargets: DebugProtocol.GotoTargetsResponse;
575
+ initialize: DebugProtocol.InitializeResponse;
576
+ inspectVariables: IInspectVariablesResponse;
577
+ launch: DebugProtocol.LaunchResponse;
578
+ loadedSources: DebugProtocol.LoadedSourcesResponse;
579
+ modules: DebugProtocol.ModulesResponse;
580
+ next: DebugProtocol.NextResponse;
581
+ pause: DebugProtocol.PauseResponse;
582
+ restart: DebugProtocol.RestartResponse;
583
+ restartFrame: DebugProtocol.RestartFrameResponse;
584
+ reverseContinue: DebugProtocol.ReverseContinueResponse;
585
+ richInspectVariables: IRichVariablesResponse;
586
+ scopes: DebugProtocol.ScopesResponse;
587
+ setBreakpoints: DebugProtocol.SetBreakpointsResponse;
588
+ setExceptionBreakpoints: DebugProtocol.SetExceptionBreakpointsResponse;
589
+ setExpression: DebugProtocol.SetExpressionResponse;
590
+ setFunctionBreakpoints: DebugProtocol.SetFunctionBreakpointsResponse;
591
+ setVariable: DebugProtocol.SetVariableResponse;
592
+ source: DebugProtocol.SourceResponse;
593
+ stackTrace: DebugProtocol.StackTraceResponse;
594
+ stepBack: DebugProtocol.StepBackResponse;
595
+ stepIn: DebugProtocol.StepInResponse;
596
+ stepInTargets: DebugProtocol.StepInTargetsResponse;
597
+ stepOut: DebugProtocol.StepOutResponse;
598
+ terminate: DebugProtocol.TerminateResponse;
599
+ terminateThreads: DebugProtocol.TerminateThreadsResponse;
600
+ threads: DebugProtocol.ThreadsResponse;
601
+ variables: DebugProtocol.VariablesResponse;
602
+ };
603
+
604
+ /**
605
+ * List of breakpoints in a source file.
606
+ */
607
+ export interface IDebugInfoBreakpoints {
608
+ source: string;
609
+ breakpoints: DebugProtocol.SourceBreakpoint[];
610
+ }
611
+
612
+ /**
613
+ * Response to 'debugInfo' request.
614
+ * This is an addition to the Debug Adapter Protocol to be able
615
+ * to retrieve the debugger state when restoring a session.
616
+ */
617
+ export interface IDebugInfoResponse extends DebugProtocol.Response {
618
+ body: {
619
+ breakpoints: IDebugInfoBreakpoints[];
620
+ hashMethod: string;
621
+ hashSeed: number;
622
+ isStarted: boolean;
623
+ /**
624
+ * Whether the kernel supports variable rich rendering or not.
625
+ */
626
+ richRendering?: boolean;
627
+ tmpFilePrefix: string;
628
+ tmpFileSuffix: string;
629
+ stoppedThreads: number[];
630
+ exceptionPaths: string[];
631
+ };
632
+ }
633
+
634
+ /**
635
+ * Arguments for 'dumpCell' request.
636
+ * This is an addition to the Debug Adapter Protocol to support
637
+ * setting breakpoints for cells.
638
+ */
639
+ export interface IDumpCellArguments {
640
+ code: string;
641
+ }
642
+
643
+ /**
644
+ * Response to 'dumpCell' request.
645
+ * This is an addition to the Debug Adapter Protocol to support
646
+ * setting breakpoints for cells.
647
+ */
648
+ export interface IDumpCellResponse extends DebugProtocol.Response {
649
+ body: {
650
+ sourcePath: string;
651
+ };
652
+ }
653
+
654
+ export interface IInspectVariablesResponse extends DebugProtocol.Response {
655
+ body: {
656
+ variables: DebugProtocol.Variable[];
657
+ };
658
+ }
659
+
660
+ /**
661
+ * Arguments for 'richVariables' request
662
+ *
663
+ * This is an addition to the Debug Adapter Protocol to support
664
+ * render rich variable representation.
665
+ */
666
+ export interface IRichVariablesArguments {
667
+ /**
668
+ * Variable name
669
+ */
670
+ variableName: string;
671
+ /**
672
+ * Frame Id
673
+ */
674
+ frameId?: number;
675
+ }
676
+
677
+ /**
678
+ * Arguments for 'richVariables' request
679
+ *
680
+ * This is an addition to the Debug Adapter Protocol to support
681
+ * rich rendering of variables.
682
+ */
683
+ export interface IRichVariablesResponse extends DebugProtocol.Response {
684
+ /**
685
+ * Variable mime type data
686
+ */
687
+ body: IRichVariable;
688
+ }
689
+
690
+ /**
691
+ * Response to the 'kernel_info_request' request.
692
+ * This interface extends the IInfoReply by adding the `debugger` key
693
+ * that isn't part of the protocol yet.
694
+ * See this pull request for more info: https://github.com/jupyter/jupyter_client/pull/486
695
+ */
696
+ export interface IInfoReply extends KernelMessage.IInfoReply {
697
+ debugger: boolean;
698
+ }
699
+
700
+ /**
701
+ * An interface for current exception filters.
702
+ */
703
+ export interface IExceptionFilter {
704
+ [kernels: string]: string[];
705
+ }
706
+ }
707
+
708
+ /**
709
+ * Select variable in the variables explorer.
710
+ *
711
+ * @hidden
712
+ *
713
+ * #### Notes
714
+ * This is experimental API
715
+ */
716
+ export interface IVariableSelection
717
+ extends Pick<
718
+ DebugProtocol.Variable,
719
+ 'name' | 'type' | 'variablesReference' | 'value'
720
+ > {}
721
+
722
+ /**
723
+ * Debugger sidebar interface.
724
+ */
725
+ export interface ISidebar extends Panel {}
726
+
727
+ /**
728
+ * A utility to find text editors used by the debugger.
729
+ */
730
+ export namespace ISources {
731
+ /**
732
+ * Source editor interface
733
+ */
734
+ export interface IEditor {
735
+ /**
736
+ * Editor getter
737
+ */
738
+ get(): CodeEditor.IEditor | null;
739
+ /**
740
+ * Reveal editor
741
+ */
742
+ reveal(): Promise<void>;
743
+ /**
744
+ * Editor source text
745
+ */
746
+ src: ISharedText;
747
+ }
748
+
749
+ /**
750
+ * Unified parameters for the find method
751
+ */
752
+ export type FindParams = {
753
+ /**
754
+ * Extra flag to focus on the parent widget of the editor.
755
+ */
756
+ focus: boolean;
757
+
758
+ /**
759
+ * Name of current kernel.
760
+ */
761
+ kernel: string;
762
+
763
+ /**
764
+ * Path of session connection.
765
+ */
766
+ path: string;
767
+
768
+ /**
769
+ * Source path
770
+ */
771
+ source: string;
772
+ };
773
+
774
+ /**
775
+ * Unified parameters for the open method
776
+ */
777
+ export type OpenParams = {
778
+ /**
779
+ * The caption for the read-only editor.
780
+ */
781
+ caption: string;
782
+
783
+ /**
784
+ * The code editor wrapper to add to the main area.
785
+ */
786
+ editorWrapper: CodeEditorWrapper;
787
+
788
+ /**
789
+ * The label for the read-only editor.
790
+ */
791
+ label: string;
792
+ };
793
+ }
794
+
795
+ /**
796
+ * A namespace for UI model definitions.
797
+ */
798
+ export namespace Model {
799
+ /**
800
+ * The breakpoints UI model.
801
+ */
802
+ export interface IBreakpoints {
803
+ /**
804
+ * Get all the breakpoints.
805
+ */
806
+ readonly breakpoints: Map<string, IDebugger.IBreakpoint[]>;
807
+
808
+ /**
809
+ * Signal emitted when the model changes.
810
+ */
811
+ readonly changed: ISignal<this, IDebugger.IBreakpoint[]>;
812
+
813
+ /**
814
+ * Signal emitted when a breakpoint is clicked.
815
+ */
816
+ readonly clicked: Signal<this, IDebugger.IBreakpoint>;
817
+
818
+ /**
819
+ * Signal emitted when the breakpoints are restored.
820
+ */
821
+ readonly restored: ISignal<this, void>;
822
+
823
+ /**
824
+ * Get the breakpoints for a given id (path).
825
+ *
826
+ * @param id The code id (path).
827
+ */
828
+ getBreakpoints(id: string): IBreakpoint[];
829
+
830
+ /**
831
+ * Restore a map of breakpoints.
832
+ *
833
+ * @param breakpoints The map of breakpoints
834
+ */
835
+ restoreBreakpoints(breakpoints: Map<string, IBreakpoint[]>): void;
836
+
837
+ /**
838
+ * Set the breakpoints for a given id (path).
839
+ *
840
+ * @param id The code id (path).
841
+ * @param breakpoints The list of breakpoints.
842
+ */
843
+ setBreakpoints(id: string, breakpoints: IBreakpoint[]): void;
844
+ }
845
+
846
+ /**
847
+ * The callstack UI model.
848
+ */
849
+ export interface ICallstack {
850
+ /**
851
+ * Signal emitted when the current frame has changed.
852
+ */
853
+ readonly currentFrameChanged: ISignal<this, IDebugger.IStackFrame | null>;
854
+
855
+ /**
856
+ * The current frame.
857
+ */
858
+ frame: IDebugger.IStackFrame | null;
859
+
860
+ /**
861
+ * The frames for the callstack.
862
+ */
863
+ frames: IDebugger.IStackFrame[];
864
+
865
+ /**
866
+ * Signal emitted when the frames have changed.
867
+ */
868
+ readonly framesChanged: ISignal<this, IDebugger.IStackFrame[]>;
869
+ }
870
+
871
+ /**
872
+ * The data model for the debugger service.
873
+ */
874
+ export interface IService {
875
+ /**
876
+ * The breakpoints UI model.
877
+ */
878
+ readonly breakpoints: IBreakpoints;
879
+
880
+ /**
881
+ * The callstack UI model.
882
+ */
883
+ readonly callstack: ICallstack;
884
+
885
+ /**
886
+ * Whether the kernel support rich variable rendering based on mime type.
887
+ */
888
+ hasRichVariableRendering: boolean;
889
+
890
+ /**
891
+ * The variables UI model.
892
+ */
893
+ readonly variables: IVariables;
894
+
895
+ /**
896
+ * The sources UI model.
897
+ */
898
+ readonly sources: ISources;
899
+
900
+ /**
901
+ * The kernel sources UI model.
902
+ */
903
+ readonly kernelSources: IKernelSources;
904
+
905
+ /**
906
+ * The set of threads in stopped state.
907
+ */
908
+ stoppedThreads: Set<number>;
909
+
910
+ /**
911
+ * The current debugger title.
912
+ */
913
+ title: string;
914
+
915
+ /**
916
+ * A signal emitted when the title changes.
917
+ */
918
+ titleChanged: ISignal<this, string>;
919
+
920
+ /**
921
+ * Clear the model.
922
+ */
923
+ clear(): void;
924
+ }
925
+
926
+ /**
927
+ * The sources UI model.
928
+ */
929
+ export interface ISources {
930
+ /**
931
+ * Signal emitted when the current frame changes.
932
+ */
933
+ readonly currentFrameChanged: ISignal<
934
+ IDebugger.Model.ICallstack,
935
+ IDebugger.IStackFrame | null
936
+ >;
937
+
938
+ /**
939
+ * Return the current source.
940
+ */
941
+ currentSource: IDebugger.Source | null;
942
+
943
+ /**
944
+ * Signal emitted when the current source changes.
945
+ */
946
+ readonly currentSourceChanged: ISignal<
947
+ IDebugger.Model.ISources,
948
+ IDebugger.Source | null
949
+ >;
950
+
951
+ /**
952
+ * Signal emitted when a source should be open in the main area.
953
+ */
954
+ readonly currentSourceOpened: ISignal<
955
+ IDebugger.Model.ISources,
956
+ IDebugger.Source | null
957
+ >;
958
+
959
+ /**
960
+ * Open a source in the main area.
961
+ */
962
+ open(): void;
963
+ }
964
+
965
+ /**
966
+ * The kernel sources UI model.
967
+ */
968
+ export interface IKernelSources extends IDisposable {
969
+ /**
970
+ * The kernel source.
971
+ */
972
+ kernelSources: IDebugger.KernelSource[] | null;
973
+
974
+ /**
975
+ * The filter to apply.
976
+ */
977
+ filter: string;
978
+
979
+ /**
980
+ * Signal emitted when the kernel sources have changed.
981
+ */
982
+ readonly changed: ISignal<
983
+ IDebugger.Model.IKernelSources,
984
+ IDebugger.KernelSource[] | null
985
+ >;
986
+
987
+ /**
988
+ * Signal emitted when the kernel sources filter has changed.
989
+ */
990
+ readonly filterChanged: ISignal<IDebugger.Model.IKernelSources, string>;
991
+
992
+ /**
993
+ * Signal emitted when a kernel source has be opened in the main area.
994
+ */
995
+ readonly kernelSourceOpened: ISignal<
996
+ IDebugger.Model.IKernelSources,
997
+ IDebugger.Source | null
998
+ >;
999
+
1000
+ /**
1001
+ * Open a source in the main area.
1002
+ */
1003
+ open(source: IDebugger.Source): void;
1004
+ }
1005
+
1006
+ /**
1007
+ * The variables UI model.
1008
+ */
1009
+ export interface IVariables {
1010
+ /**
1011
+ * Signal emitted when the current variable has changed.
1012
+ */
1013
+ readonly changed: ISignal<this, void>;
1014
+
1015
+ /**
1016
+ * The variable scopes.
1017
+ */
1018
+ scopes: IDebugger.IScope[];
1019
+
1020
+ /**
1021
+ * Signal emitted when the current variable has been expanded.
1022
+ */
1023
+ readonly variableExpanded: ISignal<this, IDebugger.IVariable>;
1024
+
1025
+ /**
1026
+ * Selected variable in the variables explorer.
1027
+ */
1028
+ selectedVariable: IVariableSelection | null;
1029
+
1030
+ /**
1031
+ * Expand a variable.
1032
+ *
1033
+ * @param variable The variable to expand.
1034
+ */
1035
+ expandVariable(variable: IDebugger.IVariable): void;
1036
+ }
1037
+ }
1038
+ }
1039
+
1040
+ /**
1041
+ * The visual debugger token.
1042
+ */
1043
+ export const IDebugger = new Token<IDebugger>('@jupyterlab/debugger:IDebugger');
1044
+
1045
+ /**
1046
+ * The debugger configuration token.
1047
+ */
1048
+ export const IDebuggerConfig = new Token<IDebugger.IConfig>(
1049
+ '@jupyterlab/debugger:IDebuggerConfig'
1050
+ );
1051
+
1052
+ /**
1053
+ * The debugger sources utility token.
1054
+ */
1055
+ export const IDebuggerSources = new Token<IDebugger.ISources>(
1056
+ '@jupyterlab/debugger:IDebuggerSources'
1057
+ );
1058
+
1059
+ /**
1060
+ * The debugger configuration token.
1061
+ */
1062
+ export const IDebuggerSidebar = new Token<IDebugger.ISidebar>(
1063
+ '@jupyterlab/debugger:IDebuggerSidebar'
1064
+ );
1065
+
1066
+ /**
1067
+ * The debugger handler token.
1068
+ */
1069
+ export const IDebuggerHandler = new Token<IDebugger.IHandler>(
1070
+ '@jupyterlab/debugger:IDebuggerHandler'
1071
+ );