@jupyterlab/debugger 4.0.0-alpha.2 → 4.0.0-alpha.20

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 (138) hide show
  1. package/lib/debugger.d.ts +4 -0
  2. package/lib/debugger.js +5 -1
  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 +24 -9
  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 +33 -11
  15. package/lib/handlers/editor.js +177 -88
  16. package/lib/handlers/editor.js.map +1 -1
  17. package/lib/handlers/file.d.ts +1 -0
  18. package/lib/handlers/file.js +11 -2
  19. package/lib/handlers/file.js.map +1 -1
  20. package/lib/handlers/notebook.d.ts +0 -7
  21. package/lib/handlers/notebook.js +22 -18
  22. package/lib/handlers/notebook.js.map +1 -1
  23. package/lib/icons.d.ts +3 -0
  24. package/lib/icons.js +15 -0
  25. package/lib/icons.js.map +1 -1
  26. package/lib/model.d.ts +5 -0
  27. package/lib/model.js +4 -0
  28. package/lib/model.js.map +1 -1
  29. package/lib/panels/breakpoints/index.d.ts +18 -0
  30. package/lib/panels/breakpoints/index.js +10 -3
  31. package/lib/panels/breakpoints/index.js.map +1 -1
  32. package/lib/panels/breakpoints/pauseonexceptions.d.ts +53 -0
  33. package/lib/panels/breakpoints/pauseonexceptions.js +98 -0
  34. package/lib/panels/breakpoints/pauseonexceptions.js.map +1 -0
  35. package/lib/panels/callstack/index.d.ts +1 -1
  36. package/lib/panels/kernelSources/body.d.ts +45 -0
  37. package/lib/panels/kernelSources/body.js +76 -0
  38. package/lib/panels/kernelSources/body.js.map +1 -0
  39. package/lib/panels/kernelSources/filter.d.ts +11 -0
  40. package/lib/panels/kernelSources/filter.js +18 -0
  41. package/lib/panels/kernelSources/filter.js.map +1 -0
  42. package/lib/panels/kernelSources/index.d.ts +39 -0
  43. package/lib/panels/kernelSources/index.js +54 -0
  44. package/lib/panels/kernelSources/index.js.map +1 -0
  45. package/lib/panels/kernelSources/model.d.ts +73 -0
  46. package/lib/panels/kernelSources/model.js +120 -0
  47. package/lib/panels/kernelSources/model.js.map +1 -0
  48. package/lib/panels/sources/body.js +5 -3
  49. package/lib/panels/sources/body.js.map +1 -1
  50. package/lib/panels/variables/grid.d.ts +8 -2
  51. package/lib/panels/variables/grid.js +29 -364
  52. package/lib/panels/variables/grid.js.map +1 -1
  53. package/lib/panels/variables/gridpanel.d.ts +140 -0
  54. package/lib/panels/variables/gridpanel.js +363 -0
  55. package/lib/panels/variables/gridpanel.js.map +1 -0
  56. package/lib/panels/variables/index.d.ts +1 -9
  57. package/lib/panels/variables/index.js +1 -15
  58. package/lib/panels/variables/index.js.map +1 -1
  59. package/lib/panels/variables/mimerenderer.d.ts +15 -2
  60. package/lib/panels/variables/mimerenderer.js +56 -17
  61. package/lib/panels/variables/mimerenderer.js.map +1 -1
  62. package/lib/panels/variables/model.d.ts +3 -0
  63. package/lib/panels/variables/model.js +7 -0
  64. package/lib/panels/variables/model.js.map +1 -1
  65. package/lib/panels/variables/scope.js +4 -0
  66. package/lib/panels/variables/scope.js.map +1 -1
  67. package/lib/panels/variables/tree.d.ts +2 -5
  68. package/lib/panels/variables/tree.js +137 -47
  69. package/lib/panels/variables/tree.js.map +1 -1
  70. package/lib/service.d.ts +32 -2
  71. package/lib/service.js +122 -9
  72. package/lib/service.js.map +1 -1
  73. package/lib/session.d.ts +37 -1
  74. package/lib/session.js +89 -6
  75. package/lib/session.js.map +1 -1
  76. package/lib/sidebar.d.ts +7 -1
  77. package/lib/sidebar.js +10 -2
  78. package/lib/sidebar.js.map +1 -1
  79. package/lib/sources.d.ts +2 -2
  80. package/lib/sources.js +32 -17
  81. package/lib/sources.js.map +1 -1
  82. package/lib/tokens.d.ts +139 -24
  83. package/lib/tokens.js.map +1 -1
  84. package/package.json +39 -47
  85. package/src/config.ts +78 -0
  86. package/src/debugger.ts +154 -0
  87. package/src/dialogs/evaluate.ts +144 -0
  88. package/src/factory.ts +72 -0
  89. package/src/handler.ts +528 -0
  90. package/src/handlers/console.ts +118 -0
  91. package/src/handlers/editor.ts +469 -0
  92. package/src/handlers/file.ts +86 -0
  93. package/src/handlers/notebook.ts +128 -0
  94. package/src/hash.ts +69 -0
  95. package/src/icons.ts +64 -0
  96. package/src/index.ts +16 -0
  97. package/src/model.ts +155 -0
  98. package/src/panels/breakpoints/body.tsx +145 -0
  99. package/src/panels/breakpoints/index.ts +116 -0
  100. package/src/panels/breakpoints/model.ts +74 -0
  101. package/src/panels/breakpoints/pauseonexceptions.tsx +141 -0
  102. package/src/panels/callstack/body.tsx +96 -0
  103. package/src/panels/callstack/index.ts +152 -0
  104. package/src/panels/callstack/model.ts +86 -0
  105. package/src/panels/kernelSources/body.tsx +139 -0
  106. package/src/panels/kernelSources/filter.tsx +44 -0
  107. package/src/panels/kernelSources/index.tsx +106 -0
  108. package/src/panels/kernelSources/model.ts +160 -0
  109. package/src/panels/sources/body.ts +161 -0
  110. package/src/panels/sources/index.tsx +85 -0
  111. package/src/panels/sources/model.ts +94 -0
  112. package/src/panels/sources/sourcepath.tsx +28 -0
  113. package/src/panels/variables/grid.ts +144 -0
  114. package/src/panels/variables/gridpanel.ts +455 -0
  115. package/src/panels/variables/index.ts +199 -0
  116. package/src/panels/variables/mimerenderer.ts +125 -0
  117. package/src/panels/variables/model.ts +61 -0
  118. package/src/panels/variables/scope.tsx +132 -0
  119. package/src/panels/variables/tree.tsx +521 -0
  120. package/src/service.ts +1009 -0
  121. package/src/session.ts +342 -0
  122. package/src/sidebar.ts +194 -0
  123. package/src/sources.ts +327 -0
  124. package/src/svg.d.ts +9 -0
  125. package/src/tokens.ts +1071 -0
  126. package/style/base.css +2 -1
  127. package/style/breakpoints.css +21 -12
  128. package/style/icons/arrow-collapse.svg +1 -1
  129. package/style/icons/arrow-expand.svg +1 -1
  130. package/style/icons/exceptions.svg +10 -0
  131. package/style/icons/open-kernel-source.svg +6 -0
  132. package/style/icons/pause.svg +6 -0
  133. package/style/icons.css +9 -8
  134. package/style/index.css +1 -1
  135. package/style/index.js +1 -1
  136. package/style/kernelSources.css +45 -0
  137. package/style/sidebar.css +1 -1
  138. package/style/variables.css +82 -21
package/src/session.ts ADDED
@@ -0,0 +1,342 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+
4
+ import { KernelMessage, Session } from '@jupyterlab/services';
5
+
6
+ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
7
+
8
+ import { PromiseDelegate } from '@lumino/coreutils';
9
+
10
+ import { ISignal, Signal } from '@lumino/signaling';
11
+
12
+ import { DebugProtocol } from '@vscode/debugprotocol';
13
+
14
+ import { IDebugger } from './tokens';
15
+
16
+ /**
17
+ * A concrete implementation of IDebugger.ISession.
18
+ */
19
+ export class DebuggerSession implements IDebugger.ISession {
20
+ /**
21
+ * Instantiate a new debug session
22
+ *
23
+ * @param options - The debug session instantiation options.
24
+ */
25
+ constructor(options: DebuggerSession.IOptions) {
26
+ this.connection = options.connection;
27
+ this._config = options.config;
28
+ this.translator = options.translator || nullTranslator;
29
+ }
30
+
31
+ /**
32
+ * Whether the debug session is disposed.
33
+ */
34
+ get isDisposed(): boolean {
35
+ return this._isDisposed;
36
+ }
37
+
38
+ /**
39
+ * Returns the initialize response .
40
+ */
41
+ get capabilities(): DebugProtocol.Capabilities | undefined {
42
+ return this._capabilities;
43
+ }
44
+
45
+ /**
46
+ * A signal emitted when the debug session is disposed.
47
+ */
48
+ get disposed(): ISignal<this, void> {
49
+ return this._disposed;
50
+ }
51
+
52
+ /**
53
+ * Returns the API session connection to connect to a debugger.
54
+ */
55
+ get connection(): Session.ISessionConnection | null {
56
+ return this._connection;
57
+ }
58
+
59
+ /**
60
+ * Sets the API session connection to connect to a debugger to
61
+ * the given parameter.
62
+ *
63
+ * @param connection - The new API session connection.
64
+ */
65
+ set connection(connection: Session.ISessionConnection | null) {
66
+ if (this._connection) {
67
+ this._connection.iopubMessage.disconnect(this._handleEvent, this);
68
+ }
69
+ this._connection = connection;
70
+
71
+ if (!this._connection) {
72
+ this._isStarted = false;
73
+ return;
74
+ }
75
+
76
+ this._connection.iopubMessage.connect(this._handleEvent, this);
77
+
78
+ this._ready = new PromiseDelegate<void>();
79
+ const future = this.connection?.kernel?.requestDebug({
80
+ type: 'request',
81
+ seq: 0,
82
+ command: 'debugInfo'
83
+ });
84
+ if (future) {
85
+ future.onReply = (msg: KernelMessage.IDebugReplyMsg): void => {
86
+ this._ready.resolve();
87
+ future.dispose();
88
+ };
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Whether the debug session is started.
94
+ */
95
+ get isStarted(): boolean {
96
+ return this._isStarted;
97
+ }
98
+
99
+ /**
100
+ * Exception paths defined by the debugger
101
+ */
102
+ get exceptionPaths(): string[] {
103
+ return this._exceptionPaths;
104
+ }
105
+
106
+ /**
107
+ * Exception breakpoint filters defined by the debugger
108
+ */
109
+ get exceptionBreakpointFilters():
110
+ | DebugProtocol.ExceptionBreakpointsFilter[]
111
+ | undefined {
112
+ return this._exceptionBreakpointFilters;
113
+ }
114
+
115
+ /**
116
+ * Get current exception filters.
117
+ */
118
+ get currentExceptionFilters(): string[] {
119
+ const kernel = this.connection?.kernel?.name ?? '';
120
+ if (!kernel) {
121
+ return [];
122
+ }
123
+ const tmpFileParams = this._config.getTmpFileParams(kernel);
124
+ if (!tmpFileParams) {
125
+ return [];
126
+ }
127
+ let prefix = tmpFileParams.prefix;
128
+ if (Object.keys(this._currentExceptionFilters).includes(prefix)) {
129
+ return this._currentExceptionFilters[prefix];
130
+ }
131
+ return [];
132
+ }
133
+
134
+ /**
135
+ * Set current exception filters.
136
+ */
137
+ set currentExceptionFilters(exceptionFilters: string[] | null) {
138
+ const kernel = this.connection?.kernel?.name ?? '';
139
+ if (!kernel) {
140
+ return;
141
+ }
142
+ const tmpFileParams = this._config.getTmpFileParams(kernel);
143
+ if (!tmpFileParams) {
144
+ return;
145
+ }
146
+ let prefix = tmpFileParams.prefix;
147
+ if (exceptionFilters === null) {
148
+ if (Object.keys(this._currentExceptionFilters).includes(prefix)) {
149
+ delete this._currentExceptionFilters[prefix];
150
+ }
151
+ } else {
152
+ this._currentExceptionFilters[prefix] = exceptionFilters;
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Signal emitted for debug event messages.
158
+ */
159
+ get eventMessage(): ISignal<IDebugger.ISession, IDebugger.ISession.Event> {
160
+ return this._eventMessage;
161
+ }
162
+
163
+ /**
164
+ * Dispose the debug session.
165
+ */
166
+ dispose(): void {
167
+ if (this._isDisposed) {
168
+ return;
169
+ }
170
+ this._isDisposed = true;
171
+ this._disposed.emit();
172
+ Signal.clearData(this);
173
+ }
174
+
175
+ /**
176
+ * Start a new debug session
177
+ */
178
+ async start(): Promise<void> {
179
+ const initializeResponse = await this.sendRequest('initialize', {
180
+ clientID: 'jupyterlab',
181
+ clientName: 'JupyterLab',
182
+ adapterID: this.connection?.kernel?.name ?? '',
183
+ pathFormat: 'path',
184
+ linesStartAt1: true,
185
+ columnsStartAt1: true,
186
+ supportsVariableType: true,
187
+ supportsVariablePaging: true,
188
+ supportsRunInTerminalRequest: true,
189
+ locale: document.documentElement.lang
190
+ });
191
+
192
+ if (!initializeResponse.success) {
193
+ throw new Error(
194
+ `Could not start the debugger: ${initializeResponse.message}`
195
+ );
196
+ }
197
+ this._capabilities = initializeResponse.body;
198
+ this._isStarted = true;
199
+ this._exceptionBreakpointFilters =
200
+ initializeResponse.body?.exceptionBreakpointFilters;
201
+ await this.sendRequest('attach', {});
202
+ }
203
+
204
+ /**
205
+ * Stop the running debug session.
206
+ */
207
+ async stop(): Promise<void> {
208
+ this._isStarted = false;
209
+ await this.sendRequest('disconnect', {
210
+ restart: false,
211
+ terminateDebuggee: false
212
+ });
213
+ }
214
+
215
+ /**
216
+ * Restore the state of a debug session.
217
+ */
218
+ async restoreState(): Promise<IDebugger.ISession.Response['debugInfo']> {
219
+ const message = await this.sendRequest('debugInfo', {});
220
+ this._isStarted = message.body.isStarted;
221
+ this._exceptionPaths = message.body?.exceptionPaths;
222
+ return message;
223
+ }
224
+
225
+ /**
226
+ * Whether the debugger is pausing on exception.
227
+ *
228
+ * @param filter - Specify a filter
229
+ */
230
+ isPausingOnException(filter?: string): boolean {
231
+ if (filter) {
232
+ return this.currentExceptionFilters?.includes(filter) ?? false;
233
+ } else {
234
+ return this.currentExceptionFilters.length > 0;
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Send a custom debug request to the kernel.
240
+ *
241
+ * @param command debug command.
242
+ * @param args arguments for the debug command.
243
+ */
244
+ async sendRequest<K extends keyof IDebugger.ISession.Request>(
245
+ command: K,
246
+ args: IDebugger.ISession.Request[K]
247
+ ): Promise<IDebugger.ISession.Response[K]> {
248
+ await this._ready.promise;
249
+ const message = await this._sendDebugMessage({
250
+ type: 'request',
251
+ seq: this._seq++,
252
+ command,
253
+ arguments: args
254
+ });
255
+ return message.content as IDebugger.ISession.Response[K];
256
+ }
257
+
258
+ /**
259
+ * Handle debug events sent on the 'iopub' channel.
260
+ *
261
+ * @param sender - the emitter of the event.
262
+ * @param message - the event message.
263
+ */
264
+ private _handleEvent(
265
+ sender: Session.ISessionConnection,
266
+ message: KernelMessage.IIOPubMessage
267
+ ): void {
268
+ const msgType = message.header.msg_type;
269
+ if (msgType !== 'debug_event') {
270
+ return;
271
+ }
272
+ const event = message.content as IDebugger.ISession.Event;
273
+ this._eventMessage.emit(event);
274
+ }
275
+
276
+ /**
277
+ * Send a debug request message to the kernel.
278
+ *
279
+ * @param msg debug request message to send to the kernel.
280
+ */
281
+ private async _sendDebugMessage(
282
+ msg: KernelMessage.IDebugRequestMsg['content']
283
+ ): Promise<KernelMessage.IDebugReplyMsg> {
284
+ const kernel = this.connection?.kernel;
285
+ if (!kernel) {
286
+ return Promise.reject(
287
+ new Error('A kernel is required to send debug messages.')
288
+ );
289
+ }
290
+ const reply = new PromiseDelegate<KernelMessage.IDebugReplyMsg>();
291
+ const future = kernel.requestDebug(msg);
292
+ future.onReply = (msg: KernelMessage.IDebugReplyMsg): void => {
293
+ reply.resolve(msg);
294
+ };
295
+ await future.done;
296
+ return reply.promise;
297
+ }
298
+
299
+ protected translator: ITranslator;
300
+ private _seq = 0;
301
+ private _ready = new PromiseDelegate<void>();
302
+ private _connection: Session.ISessionConnection | null;
303
+ private _config: IDebugger.IConfig;
304
+ private _capabilities: DebugProtocol.Capabilities | undefined;
305
+ private _isDisposed = false;
306
+ private _isStarted = false;
307
+ private _exceptionPaths: string[] = [];
308
+ private _exceptionBreakpointFilters:
309
+ | DebugProtocol.ExceptionBreakpointsFilter[]
310
+ | undefined = [];
311
+ private _currentExceptionFilters: IDebugger.ISession.IExceptionFilter = {};
312
+ private _disposed = new Signal<this, void>(this);
313
+ private _eventMessage = new Signal<
314
+ IDebugger.ISession,
315
+ IDebugger.ISession.Event
316
+ >(this);
317
+ }
318
+
319
+ /**
320
+ * A namespace for `DebuggerSession` statics.
321
+ */
322
+ export namespace DebuggerSession {
323
+ /**
324
+ * Instantiation options for a `DebuggerSession`.
325
+ */
326
+ export interface IOptions {
327
+ /**
328
+ * The session connection used by the debug session.
329
+ */
330
+ connection: Session.ISessionConnection;
331
+
332
+ /**
333
+ * The debugger config
334
+ */
335
+ config: IDebugger.IConfig;
336
+
337
+ /**
338
+ * The application language translator.
339
+ */
340
+ translator?: ITranslator;
341
+ }
342
+ }
package/src/sidebar.ts ADDED
@@ -0,0 +1,194 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+
4
+ import { IThemeManager } from '@jupyterlab/apputils';
5
+
6
+ import { IEditorServices } from '@jupyterlab/codeeditor';
7
+
8
+ import { ITranslator, nullTranslator } from '@jupyterlab/translation';
9
+
10
+ import { bugIcon, SidePanel } from '@jupyterlab/ui-components';
11
+
12
+ import { Widget } from '@lumino/widgets';
13
+
14
+ import { Breakpoints as BreakpointsPanel } from './panels/breakpoints';
15
+
16
+ import { Callstack as CallstackPanel } from './panels/callstack';
17
+
18
+ import { Sources as SourcesPanel } from './panels/sources';
19
+
20
+ import { KernelSources as KernelSourcesPanel } from './panels/kernelSources';
21
+
22
+ import { Variables as VariablesPanel } from './panels/variables';
23
+
24
+ import { IDebugger } from './tokens';
25
+
26
+ /**
27
+ * A debugger sidebar.
28
+ */
29
+ export class DebuggerSidebar extends SidePanel {
30
+ /**
31
+ * Instantiate a new Debugger.Sidebar
32
+ *
33
+ * @param options The instantiation options for a Debugger.Sidebar
34
+ */
35
+ constructor(options: DebuggerSidebar.IOptions) {
36
+ const translator = options.translator || nullTranslator;
37
+ super({ translator });
38
+ this.id = 'jp-debugger-sidebar';
39
+ this.title.icon = bugIcon;
40
+ this.addClass('jp-DebuggerSidebar');
41
+
42
+ const {
43
+ callstackCommands,
44
+ breakpointsCommands,
45
+ editorServices,
46
+ service,
47
+ themeManager
48
+ } = options;
49
+ const model = service.model;
50
+
51
+ this.variables = new VariablesPanel({
52
+ model: model.variables,
53
+ commands: callstackCommands.registry,
54
+ service,
55
+ themeManager,
56
+ translator
57
+ });
58
+
59
+ this.callstack = new CallstackPanel({
60
+ commands: callstackCommands,
61
+ model: model.callstack,
62
+ translator
63
+ });
64
+
65
+ this.breakpoints = new BreakpointsPanel({
66
+ service,
67
+ commands: breakpointsCommands,
68
+ model: model.breakpoints,
69
+ translator
70
+ });
71
+
72
+ this.sources = new SourcesPanel({
73
+ model: model.sources,
74
+ service,
75
+ editorServices,
76
+ translator
77
+ });
78
+
79
+ this.kernelSources = new KernelSourcesPanel({
80
+ model: model.kernelSources,
81
+ service,
82
+ translator
83
+ });
84
+
85
+ const header = new DebuggerSidebar.Header();
86
+
87
+ this.header.addWidget(header);
88
+ model.titleChanged.connect((_, title) => {
89
+ header.title.label = title;
90
+ });
91
+
92
+ this.content.addClass('jp-DebuggerSidebar-body');
93
+
94
+ this.addWidget(this.variables);
95
+ this.addWidget(this.callstack);
96
+ this.addWidget(this.breakpoints);
97
+ this.addWidget(this.sources);
98
+ this.addWidget(this.kernelSources);
99
+ }
100
+
101
+ /**
102
+ * The variables widget.
103
+ */
104
+ readonly variables: VariablesPanel;
105
+
106
+ /**
107
+ * The callstack widget.
108
+ */
109
+ readonly callstack: CallstackPanel;
110
+
111
+ /**
112
+ * The breakpoints widget.
113
+ */
114
+ readonly breakpoints: BreakpointsPanel;
115
+
116
+ /**
117
+ * The sources widget.
118
+ */
119
+ readonly sources: SourcesPanel;
120
+
121
+ readonly kernelSources: KernelSourcesPanel;
122
+ }
123
+
124
+ /**
125
+ * A namespace for DebuggerSidebar statics
126
+ */
127
+ export namespace DebuggerSidebar {
128
+ /**
129
+ * Instantiation options for `DebuggerSidebar`.
130
+ */
131
+ export interface IOptions {
132
+ /**
133
+ * The debug service.
134
+ */
135
+ service: IDebugger;
136
+
137
+ /**
138
+ * The callstack toolbar commands.
139
+ */
140
+ callstackCommands: CallstackPanel.ICommands;
141
+
142
+ /**
143
+ * The callstack toolbar commands.
144
+ */
145
+ breakpointsCommands: BreakpointsPanel.ICommands;
146
+
147
+ /**
148
+ * The editor services.
149
+ */
150
+ editorServices: IEditorServices;
151
+
152
+ /**
153
+ * An optional application theme manager to detect theme changes.
154
+ */
155
+ themeManager?: IThemeManager | null;
156
+
157
+ /**
158
+ * An optional application language translator.
159
+ */
160
+ translator?: ITranslator;
161
+ }
162
+
163
+ /**
164
+ * The header for a debugger sidebar.
165
+ */
166
+ export class Header extends Widget {
167
+ /**
168
+ * Instantiate a new sidebar header.
169
+ */
170
+ constructor() {
171
+ super({ node: Private.createHeader() });
172
+ this.title.changed.connect(_ => {
173
+ this.node.textContent = this.title.label;
174
+ });
175
+ }
176
+ }
177
+ }
178
+
179
+ /**
180
+ * A namespace for private module data.
181
+ */
182
+ namespace Private {
183
+ /**
184
+ * Create a sidebar header node.
185
+ */
186
+ export function createHeader(): HTMLElement {
187
+ const title = document.createElement('h2');
188
+
189
+ title.textContent = '-';
190
+ title.classList.add('jp-text-truncated');
191
+
192
+ return title;
193
+ }
194
+ }