@opensumi/sumi 3.3.1 → 3.3.2-next-1725604464.0
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/sumi",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2-next-1725604464.0",
|
|
4
4
|
"typings": "index.d.ts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"build": "tsx ./build.ts"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@opensumi/ide-components": "3.3.
|
|
15
|
+
"@opensumi/ide-components": "3.3.2-next-1725604464.0",
|
|
16
16
|
"vscode-uri": "3.0.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/react": "^18.2.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "ab685778fe6197d12ce1b941b704900b2fac1237"
|
|
22
22
|
}
|
|
@@ -551,6 +551,146 @@ declare module 'vscode' {
|
|
|
551
551
|
// Properties: see details [here](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Breakpoint).
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
/**
|
|
555
|
+
* An item from the {@link DebugVisualizationTree}
|
|
556
|
+
*/
|
|
557
|
+
export interface DebugTreeItem {
|
|
558
|
+
/**
|
|
559
|
+
* A human-readable string describing this item.
|
|
560
|
+
*/
|
|
561
|
+
label: string;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* A human-readable string which is rendered less prominent.
|
|
565
|
+
*/
|
|
566
|
+
description?: string;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* {@link TreeItemCollapsibleState} of the tree item.
|
|
570
|
+
*/
|
|
571
|
+
collapsibleState?: TreeItemCollapsibleState;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Context value of the tree item. This can be used to contribute item specific actions in the tree.
|
|
575
|
+
* For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context`
|
|
576
|
+
* using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`.
|
|
577
|
+
* ```json
|
|
578
|
+
* "contributes": {
|
|
579
|
+
* "menus": {
|
|
580
|
+
* "view/item/context": [
|
|
581
|
+
* {
|
|
582
|
+
* "command": "extension.deleteFolder",
|
|
583
|
+
* "when": "viewItem == folder"
|
|
584
|
+
* }
|
|
585
|
+
* ]
|
|
586
|
+
* }
|
|
587
|
+
* }
|
|
588
|
+
* ```
|
|
589
|
+
* This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`.
|
|
590
|
+
*/
|
|
591
|
+
contextValue?: string;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Whether this item can be edited by the user.
|
|
595
|
+
*/
|
|
596
|
+
canEdit?: boolean;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Provides a tree that can be referenced in debug visualizations.
|
|
601
|
+
*/
|
|
602
|
+
export interface DebugVisualizationTree<T extends DebugTreeItem = DebugTreeItem> {
|
|
603
|
+
/**
|
|
604
|
+
* Gets the tree item for an element or the base context item.
|
|
605
|
+
*/
|
|
606
|
+
getTreeItem(context: DebugVisualizationContext): ProviderResult<T>;
|
|
607
|
+
/**
|
|
608
|
+
* Gets children for the tree item or the best context item.
|
|
609
|
+
*/
|
|
610
|
+
getChildren(element: T): ProviderResult<T[]>;
|
|
611
|
+
/**
|
|
612
|
+
* Handles the user editing an item.
|
|
613
|
+
*/
|
|
614
|
+
editItem?(item: T, value: string): ProviderResult<T>;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export class DebugVisualization {
|
|
618
|
+
/**
|
|
619
|
+
* The name of the visualization to show to the user.
|
|
620
|
+
*/
|
|
621
|
+
name: string;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* An icon for the view when it's show in inline actions.
|
|
625
|
+
*/
|
|
626
|
+
iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Visualization to use for the variable. This may be either:
|
|
630
|
+
* - A command to run when the visualization is selected for a variable.
|
|
631
|
+
* - A reference to a previously-registered {@link DebugVisualizationTree}
|
|
632
|
+
*/
|
|
633
|
+
visualization?: Command | { treeId: string };
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Creates a new debug visualization object.
|
|
637
|
+
* @param name Name of the visualization to show to the user.
|
|
638
|
+
*/
|
|
639
|
+
constructor(name: string);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export interface DebugVisualizationProvider<T extends DebugVisualization = DebugVisualization> {
|
|
643
|
+
/**
|
|
644
|
+
* Called for each variable when the debug session stops. It should return
|
|
645
|
+
* any visualizations the extension wishes to show to the user.
|
|
646
|
+
*
|
|
647
|
+
* Note that this is only called when its `when` clause defined under the
|
|
648
|
+
* `debugVisualizers` contribution point in the `package.json` evaluates
|
|
649
|
+
* to true.
|
|
650
|
+
*/
|
|
651
|
+
provideDebugVisualization(context: DebugVisualizationContext, token: CancellationToken): ProviderResult<T[]>;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Invoked for a variable when a user picks the visualizer.
|
|
655
|
+
*
|
|
656
|
+
* It may return a {@link TreeView} that's shown in the Debug Console or
|
|
657
|
+
* inline in a hover. A visualizer may choose to return `undefined` from
|
|
658
|
+
* this function and instead trigger other actions in the UI, such as opening
|
|
659
|
+
* a custom {@link WebviewView}.
|
|
660
|
+
*/
|
|
661
|
+
resolveDebugVisualization?(visualization: T, token: CancellationToken): ProviderResult<T>;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export interface DebugVisualizationContext {
|
|
665
|
+
/**
|
|
666
|
+
* The Debug Adapter Protocol Variable to be visualized.
|
|
667
|
+
* @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
|
|
668
|
+
*/
|
|
669
|
+
variable: any;
|
|
670
|
+
/**
|
|
671
|
+
* The Debug Adapter Protocol variable reference the type (such as a scope
|
|
672
|
+
* or another variable) that contained this one. Empty for variables
|
|
673
|
+
* that came from user evaluations in the Debug Console.
|
|
674
|
+
* @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
|
|
675
|
+
*/
|
|
676
|
+
containerId?: number;
|
|
677
|
+
/**
|
|
678
|
+
* The ID of the Debug Adapter Protocol StackFrame in which the variable was found,
|
|
679
|
+
* for variables that came from scopes in a stack frame.
|
|
680
|
+
* @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
|
|
681
|
+
*/
|
|
682
|
+
frameId?: number;
|
|
683
|
+
/**
|
|
684
|
+
* The ID of the Debug Adapter Protocol Thread in which the variable was found.
|
|
685
|
+
* @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
|
|
686
|
+
*/
|
|
687
|
+
threadId: number;
|
|
688
|
+
/**
|
|
689
|
+
* The debug session the variable belongs to.
|
|
690
|
+
*/
|
|
691
|
+
session: DebugSession;
|
|
692
|
+
}
|
|
693
|
+
|
|
554
694
|
/**
|
|
555
695
|
* Namespace for debug functionality.
|
|
556
696
|
*/
|
|
@@ -693,5 +833,26 @@ declare module 'vscode' {
|
|
|
693
833
|
* @return A uri that can be used to load the contents of the source.
|
|
694
834
|
*/
|
|
695
835
|
export function asDebugSourceUri(source: DebugProtocolSource, session?: DebugSession): Uri;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Registers a custom data visualization for variables when debugging.
|
|
839
|
+
*
|
|
840
|
+
* @param id The corresponding ID in the package.json `debugVisualizers` contribution point.
|
|
841
|
+
* @param provider The {@link DebugVisualizationProvider} to register
|
|
842
|
+
*/
|
|
843
|
+
export function registerDebugVisualizationProvider<T extends DebugVisualization>(
|
|
844
|
+
id: string,
|
|
845
|
+
provider: DebugVisualizationProvider<T>
|
|
846
|
+
): Disposable;
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Registers a tree that can be referenced by {@link DebugVisualization.visualization}.
|
|
850
|
+
* @param id
|
|
851
|
+
* @param provider
|
|
852
|
+
*/
|
|
853
|
+
export function registerDebugVisualizationTreeProvider<T extends DebugTreeItem>(
|
|
854
|
+
id: string,
|
|
855
|
+
provider: DebugVisualizationTree<T>
|
|
856
|
+
): Disposable;
|
|
696
857
|
}
|
|
697
858
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'vscode' {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
3
|
* Represents a text document, such as a source file. Text documents have
|
|
4
4
|
* [lines](#TextLine) and knowledge about an underlying resource like a file.
|
|
5
5
|
*/
|
|
@@ -264,4 +264,586 @@ declare module 'vscode' {
|
|
|
264
264
|
*/
|
|
265
265
|
waitUntil(thenable: Thenable<any>): void;
|
|
266
266
|
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A notebook cell kind.
|
|
270
|
+
*/
|
|
271
|
+
export enum NotebookCellKind {
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A markup-cell is formatted source that is used for display.
|
|
275
|
+
*/
|
|
276
|
+
Markup = 1,
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* A code-cell is source that can be {@link NotebookController executed} and that
|
|
280
|
+
* produces {@link NotebookCellOutput output}.
|
|
281
|
+
*/
|
|
282
|
+
Code = 2
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Represents a cell of a {@link NotebookDocument notebook}, either a {@link NotebookCellKind.Code code}-cell
|
|
287
|
+
* or {@link NotebookCellKind.Markup markup}-cell.
|
|
288
|
+
*
|
|
289
|
+
* NotebookCell instances are immutable and are kept in sync for as long as they are part of their notebook.
|
|
290
|
+
*/
|
|
291
|
+
export interface NotebookCell {
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* The index of this cell in its {@link NotebookDocument.cellAt containing notebook}. The
|
|
295
|
+
* index is updated when a cell is moved within its notebook. The index is `-1`
|
|
296
|
+
* when the cell has been removed from its notebook.
|
|
297
|
+
*/
|
|
298
|
+
readonly index: number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The {@link NotebookDocument notebook} that contains this cell.
|
|
302
|
+
*/
|
|
303
|
+
readonly notebook: NotebookDocument;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The kind of this cell.
|
|
307
|
+
*/
|
|
308
|
+
readonly kind: NotebookCellKind;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The {@link TextDocument text} of this cell, represented as text document.
|
|
312
|
+
*/
|
|
313
|
+
readonly document: TextDocument;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The metadata of this cell. Can be anything but must be JSON-stringifyable.
|
|
317
|
+
*/
|
|
318
|
+
readonly metadata: { readonly [key: string]: any };
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The outputs of this cell.
|
|
322
|
+
*/
|
|
323
|
+
readonly outputs: readonly NotebookCellOutput[];
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* The most recent {@link NotebookCellExecutionSummary execution summary} for this cell.
|
|
327
|
+
*/
|
|
328
|
+
readonly executionSummary: NotebookCellExecutionSummary | undefined;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* proposed api
|
|
332
|
+
* Mime type determines how the markup cell's `value` is interpreted.
|
|
333
|
+
*
|
|
334
|
+
* The mime selects which notebook renders is used to render the cell.
|
|
335
|
+
*
|
|
336
|
+
* If not set, internally the cell is treated as having a mime type of `text/plain`.
|
|
337
|
+
* Cells that set `language` to `markdown` instead are treated as `text/markdown`.
|
|
338
|
+
*/
|
|
339
|
+
mime: string | undefined;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Represents a notebook which itself is a sequence of {@link NotebookCell code or markup cells}. Notebook documents are
|
|
344
|
+
* created from {@link NotebookData notebook data}.
|
|
345
|
+
*/
|
|
346
|
+
export interface NotebookDocument {
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The associated uri for this notebook.
|
|
350
|
+
*
|
|
351
|
+
* *Note* that most notebooks use the `file`-scheme, which means they are files on disk. However, **not** all notebooks are
|
|
352
|
+
* saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk.
|
|
353
|
+
*
|
|
354
|
+
* @see {@link FileSystemProvider}
|
|
355
|
+
*/
|
|
356
|
+
readonly uri: Uri;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* The type of notebook.
|
|
360
|
+
*/
|
|
361
|
+
readonly notebookType: string;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* The version number of this notebook (it will strictly increase after each
|
|
365
|
+
* change, including undo/redo).
|
|
366
|
+
*/
|
|
367
|
+
readonly version: number;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* `true` if there are unpersisted changes.
|
|
371
|
+
*/
|
|
372
|
+
readonly isDirty: boolean;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Is this notebook representing an untitled file which has not been saved yet.
|
|
376
|
+
*/
|
|
377
|
+
readonly isUntitled: boolean;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* `true` if the notebook has been closed. A closed notebook isn't synchronized anymore
|
|
381
|
+
* and won't be re-used when the same resource is opened again.
|
|
382
|
+
*/
|
|
383
|
+
readonly isClosed: boolean;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Arbitrary metadata for this notebook. Can be anything but must be JSON-stringifyable.
|
|
387
|
+
*/
|
|
388
|
+
readonly metadata: { [key: string]: any };
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* The number of cells in the notebook.
|
|
392
|
+
*/
|
|
393
|
+
readonly cellCount: number;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Return the cell at the specified index. The index will be adjusted to the notebook.
|
|
397
|
+
*
|
|
398
|
+
* @param index - The index of the cell to retrieve.
|
|
399
|
+
* @returns A {@link NotebookCell cell}.
|
|
400
|
+
*/
|
|
401
|
+
cellAt(index: number): NotebookCell;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Get the cells of this notebook. A subset can be retrieved by providing
|
|
405
|
+
* a range. The range will be adjusted to the notebook.
|
|
406
|
+
*
|
|
407
|
+
* @param range A notebook range.
|
|
408
|
+
* @returns The cells contained by the range or all cells.
|
|
409
|
+
*/
|
|
410
|
+
getCells(range?: NotebookRange): NotebookCell[];
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Save the document. The saving will be handled by the corresponding {@link NotebookSerializer serializer}.
|
|
414
|
+
*
|
|
415
|
+
* @returns A promise that will resolve to true when the document
|
|
416
|
+
* has been saved. Will return false if the file was not dirty or when save failed.
|
|
417
|
+
*/
|
|
418
|
+
save(): Thenable<boolean>;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Describes a change to a notebook cell.
|
|
423
|
+
*
|
|
424
|
+
* @see {@link NotebookDocumentChangeEvent}
|
|
425
|
+
*/
|
|
426
|
+
export interface NotebookDocumentCellChange {
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The affected cell.
|
|
430
|
+
*/
|
|
431
|
+
readonly cell: NotebookCell;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* The document of the cell or `undefined` when it did not change.
|
|
435
|
+
*
|
|
436
|
+
* *Note* that you should use the {@link workspace.onDidChangeTextDocument onDidChangeTextDocument}-event
|
|
437
|
+
* for detailed change information, like what edits have been performed.
|
|
438
|
+
*/
|
|
439
|
+
readonly document: TextDocument | undefined;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* The new metadata of the cell or `undefined` when it did not change.
|
|
443
|
+
*/
|
|
444
|
+
readonly metadata: { [key: string]: any } | undefined;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* The new outputs of the cell or `undefined` when they did not change.
|
|
448
|
+
*/
|
|
449
|
+
readonly outputs: readonly NotebookCellOutput[] | undefined;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* The new execution summary of the cell or `undefined` when it did not change.
|
|
453
|
+
*/
|
|
454
|
+
readonly executionSummary: NotebookCellExecutionSummary | undefined;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Describes a structural change to a notebook document, e.g newly added and removed cells.
|
|
459
|
+
*
|
|
460
|
+
* @see {@link NotebookDocumentChangeEvent}
|
|
461
|
+
*/
|
|
462
|
+
export interface NotebookDocumentContentChange {
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The range at which cells have been either added or removed.
|
|
466
|
+
*
|
|
467
|
+
* Note that no cells have been {@link NotebookDocumentContentChange.removedCells removed}
|
|
468
|
+
* when this range is {@link NotebookRange.isEmpty empty}.
|
|
469
|
+
*/
|
|
470
|
+
readonly range: NotebookRange;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Cells that have been added to the document.
|
|
474
|
+
*/
|
|
475
|
+
readonly addedCells: readonly NotebookCell[];
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Cells that have been removed from the document.
|
|
479
|
+
*/
|
|
480
|
+
readonly removedCells: readonly NotebookCell[];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* An event describing a transactional {@link NotebookDocument notebook} change.
|
|
485
|
+
*/
|
|
486
|
+
export interface NotebookDocumentChangeEvent {
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* The affected notebook.
|
|
490
|
+
*/
|
|
491
|
+
readonly notebook: NotebookDocument;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* The new metadata of the notebook or `undefined` when it did not change.
|
|
495
|
+
*/
|
|
496
|
+
readonly metadata: { [key: string]: any } | undefined;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* An array of content changes describing added or removed {@link NotebookCell cells}.
|
|
500
|
+
*/
|
|
501
|
+
readonly contentChanges: readonly NotebookDocumentContentChange[];
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* An array of {@link NotebookDocumentCellChange cell changes}.
|
|
505
|
+
*/
|
|
506
|
+
readonly cellChanges: readonly NotebookDocumentCellChange[];
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* An event that is fired when a {@link NotebookDocument notebook document} will be saved.
|
|
511
|
+
*
|
|
512
|
+
* To make modifications to the document before it is being saved, call the
|
|
513
|
+
* {@linkcode NotebookDocumentWillSaveEvent.waitUntil waitUntil}-function with a thenable
|
|
514
|
+
* that resolves to a {@link WorkspaceEdit workspace edit}.
|
|
515
|
+
*/
|
|
516
|
+
export interface NotebookDocumentWillSaveEvent {
|
|
517
|
+
/**
|
|
518
|
+
* A cancellation token.
|
|
519
|
+
*/
|
|
520
|
+
readonly token: CancellationToken;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* The {@link NotebookDocument notebook document} that will be saved.
|
|
524
|
+
*/
|
|
525
|
+
readonly notebook: NotebookDocument;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* The reason why save was triggered.
|
|
529
|
+
*/
|
|
530
|
+
readonly reason: TextDocumentSaveReason;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Allows to pause the event loop and to apply {@link WorkspaceEdit workspace edit}.
|
|
534
|
+
* Edits of subsequent calls to this function will be applied in order. The
|
|
535
|
+
* edits will be *ignored* if concurrent modifications of the notebook document happened.
|
|
536
|
+
*
|
|
537
|
+
* *Note:* This function can only be called during event dispatch and not
|
|
538
|
+
* in an asynchronous manner:
|
|
539
|
+
*
|
|
540
|
+
* ```ts
|
|
541
|
+
* workspace.onWillSaveNotebookDocument(event => {
|
|
542
|
+
* // async, will *throw* an error
|
|
543
|
+
* setTimeout(() => event.waitUntil(promise));
|
|
544
|
+
*
|
|
545
|
+
* // sync, OK
|
|
546
|
+
* event.waitUntil(promise);
|
|
547
|
+
* })
|
|
548
|
+
* ```
|
|
549
|
+
*
|
|
550
|
+
* @param thenable A thenable that resolves to {@link WorkspaceEdit workspace edit}.
|
|
551
|
+
*/
|
|
552
|
+
waitUntil(thenable: Thenable<WorkspaceEdit>): void;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Allows to pause the event loop until the provided thenable resolved.
|
|
556
|
+
*
|
|
557
|
+
* *Note:* This function can only be called during event dispatch.
|
|
558
|
+
*
|
|
559
|
+
* @param thenable A thenable that delays saving.
|
|
560
|
+
*/
|
|
561
|
+
waitUntil(thenable: Thenable<any>): void;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* The summary of a notebook cell execution.
|
|
566
|
+
*/
|
|
567
|
+
export interface NotebookCellExecutionSummary {
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The order in which the execution happened.
|
|
571
|
+
*/
|
|
572
|
+
readonly executionOrder?: number;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* If the execution finished successfully.
|
|
576
|
+
*/
|
|
577
|
+
readonly success?: boolean;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* The times at which execution started and ended, as unix timestamps
|
|
581
|
+
*/
|
|
582
|
+
readonly timing?: {
|
|
583
|
+
/**
|
|
584
|
+
* Execution start time.
|
|
585
|
+
*/
|
|
586
|
+
readonly startTime: number;
|
|
587
|
+
/**
|
|
588
|
+
* Execution end time.
|
|
589
|
+
*/
|
|
590
|
+
readonly endTime: number;
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* A notebook range represents an ordered pair of two cell indices.
|
|
596
|
+
* It is guaranteed that start is less than or equal to end.
|
|
597
|
+
*/
|
|
598
|
+
export class NotebookRange {
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* The zero-based start index of this range.
|
|
602
|
+
*/
|
|
603
|
+
readonly start: number;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* The exclusive end index of this range (zero-based).
|
|
607
|
+
*/
|
|
608
|
+
readonly end: number;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* `true` if `start` and `end` are equal.
|
|
612
|
+
*/
|
|
613
|
+
readonly isEmpty: boolean;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Create a new notebook range. If `start` is not
|
|
617
|
+
* before or equal to `end`, the values will be swapped.
|
|
618
|
+
*
|
|
619
|
+
* @param start start index
|
|
620
|
+
* @param end end index.
|
|
621
|
+
*/
|
|
622
|
+
constructor(start: number, end: number);
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Derive a new range for this range.
|
|
626
|
+
*
|
|
627
|
+
* @param change An object that describes a change to this range.
|
|
628
|
+
* @returns A range that reflects the given change. Will return `this` range if the change
|
|
629
|
+
* is not changing anything.
|
|
630
|
+
*/
|
|
631
|
+
with(change: {
|
|
632
|
+
/**
|
|
633
|
+
* New start index, defaults to `this.start`.
|
|
634
|
+
*/
|
|
635
|
+
start?: number;
|
|
636
|
+
/**
|
|
637
|
+
* New end index, defaults to `this.end`.
|
|
638
|
+
*/
|
|
639
|
+
end?: number;
|
|
640
|
+
}): NotebookRange;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* One representation of a {@link NotebookCellOutput notebook output}, defined by MIME type and data.
|
|
645
|
+
*/
|
|
646
|
+
export class NotebookCellOutputItem {
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Factory function to create a `NotebookCellOutputItem` from a string.
|
|
650
|
+
*
|
|
651
|
+
* *Note* that an UTF-8 encoder is used to create bytes for the string.
|
|
652
|
+
*
|
|
653
|
+
* @param value A string.
|
|
654
|
+
* @param mime Optional MIME type, defaults to `text/plain`.
|
|
655
|
+
* @returns A new output item object.
|
|
656
|
+
*/
|
|
657
|
+
static text(value: string, mime?: string): NotebookCellOutputItem;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Factory function to create a `NotebookCellOutputItem` from
|
|
661
|
+
* a JSON object.
|
|
662
|
+
*
|
|
663
|
+
* *Note* that this function is not expecting "stringified JSON" but
|
|
664
|
+
* an object that can be stringified. This function will throw an error
|
|
665
|
+
* when the passed value cannot be JSON-stringified.
|
|
666
|
+
*
|
|
667
|
+
* @param value A JSON-stringifyable value.
|
|
668
|
+
* @param mime Optional MIME type, defaults to `application/json`
|
|
669
|
+
* @returns A new output item object.
|
|
670
|
+
*/
|
|
671
|
+
static json(value: any, mime?: string): NotebookCellOutputItem;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Factory function to create a `NotebookCellOutputItem` that uses
|
|
675
|
+
* uses the `application/vnd.code.notebook.stdout` mime type.
|
|
676
|
+
*
|
|
677
|
+
* @param value A string.
|
|
678
|
+
* @returns A new output item object.
|
|
679
|
+
*/
|
|
680
|
+
static stdout(value: string): NotebookCellOutputItem;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Factory function to create a `NotebookCellOutputItem` that uses
|
|
684
|
+
* uses the `application/vnd.code.notebook.stderr` mime type.
|
|
685
|
+
*
|
|
686
|
+
* @param value A string.
|
|
687
|
+
* @returns A new output item object.
|
|
688
|
+
*/
|
|
689
|
+
static stderr(value: string): NotebookCellOutputItem;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Factory function to create a `NotebookCellOutputItem` that uses
|
|
693
|
+
* uses the `application/vnd.code.notebook.error` mime type.
|
|
694
|
+
*
|
|
695
|
+
* @param value An error object.
|
|
696
|
+
* @returns A new output item object.
|
|
697
|
+
*/
|
|
698
|
+
static error(value: Error): NotebookCellOutputItem;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* The mime type which determines how the {@linkcode NotebookCellOutputItem.data data}-property
|
|
702
|
+
* is interpreted.
|
|
703
|
+
*
|
|
704
|
+
* Notebooks have built-in support for certain mime-types, extensions can add support for new
|
|
705
|
+
* types and override existing types.
|
|
706
|
+
*/
|
|
707
|
+
mime: string;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* The data of this output item. Must always be an array of unsigned 8-bit integers.
|
|
711
|
+
*/
|
|
712
|
+
data: Uint8Array;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Create a new notebook cell output item.
|
|
716
|
+
*
|
|
717
|
+
* @param data The value of the output item.
|
|
718
|
+
* @param mime The mime type of the output item.
|
|
719
|
+
*/
|
|
720
|
+
constructor(data: Uint8Array, mime: string);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Notebook cell output represents a result of executing a cell. It is a container type for multiple
|
|
725
|
+
* {@link NotebookCellOutputItem output items} where contained items represent the same result but
|
|
726
|
+
* use different MIME types.
|
|
727
|
+
*/
|
|
728
|
+
export class NotebookCellOutput {
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* @deprecated
|
|
733
|
+
*/
|
|
734
|
+
id: string;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* The output items of this output. Each item must represent the same result. _Note_ that repeated
|
|
738
|
+
* MIME types per output is invalid and that the editor will just pick one of them.
|
|
739
|
+
*
|
|
740
|
+
* ```ts
|
|
741
|
+
* new vscode.NotebookCellOutput([
|
|
742
|
+
* vscode.NotebookCellOutputItem.text('Hello', 'text/plain'),
|
|
743
|
+
* vscode.NotebookCellOutputItem.text('<i>Hello</i>', 'text/html'),
|
|
744
|
+
* vscode.NotebookCellOutputItem.text('_Hello_', 'text/markdown'),
|
|
745
|
+
* vscode.NotebookCellOutputItem.text('Hey', 'text/plain'), // INVALID: repeated type, editor will pick just one
|
|
746
|
+
* ])
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
items: NotebookCellOutputItem[];
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Arbitrary metadata for this cell output. Can be anything but must be JSON-stringifyable.
|
|
753
|
+
*/
|
|
754
|
+
metadata?: { [key: string]: any };
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Create new notebook output.
|
|
758
|
+
*
|
|
759
|
+
* @param items Notebook output items.
|
|
760
|
+
* @param metadata Optional metadata.
|
|
761
|
+
*/
|
|
762
|
+
constructor(items: NotebookCellOutputItem[], metadata?: { [key: string]: any });
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* NotebookCellData is the raw representation of notebook cells. Its is part of {@linkcode NotebookData}.
|
|
767
|
+
*/
|
|
768
|
+
export class NotebookCellData {
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* The {@link NotebookCellKind kind} of this cell data.
|
|
772
|
+
*/
|
|
773
|
+
kind: NotebookCellKind;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* The source value of this cell data - either source code or formatted text.
|
|
777
|
+
*/
|
|
778
|
+
value: string;
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* The language identifier of the source value of this cell data. Any value from
|
|
782
|
+
* {@linkcode languages.getLanguages getLanguages} is possible.
|
|
783
|
+
*/
|
|
784
|
+
languageId: string;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* The outputs of this cell data.
|
|
788
|
+
*/
|
|
789
|
+
outputs?: NotebookCellOutput[];
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Arbitrary metadata of this cell data. Can be anything but must be JSON-stringifyable.
|
|
793
|
+
*/
|
|
794
|
+
metadata?: { [key: string]: any };
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* The execution summary of this cell data.
|
|
798
|
+
*/
|
|
799
|
+
executionSummary?: NotebookCellExecutionSummary;
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Mime type determines how the cell's `value` is interpreted.
|
|
803
|
+
*
|
|
804
|
+
* The mime selects which notebook renders is used to render the cell.
|
|
805
|
+
*
|
|
806
|
+
* If not set, internally the cell is treated as having a mime type of `text/plain`.
|
|
807
|
+
* Cells that set `language` to `markdown` instead are treated as `text/markdown`.
|
|
808
|
+
*/
|
|
809
|
+
mime?: string;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Create new cell data. Minimal cell data specifies its kind, its source value, and the
|
|
813
|
+
* language identifier of its source.
|
|
814
|
+
*
|
|
815
|
+
* @param kind The kind.
|
|
816
|
+
* @param value The source value.
|
|
817
|
+
* @param languageId The language identifier of the source value.
|
|
818
|
+
*/
|
|
819
|
+
constructor(kind: NotebookCellKind, value: string, languageId: string);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Raw representation of a notebook.
|
|
824
|
+
*
|
|
825
|
+
* Extensions are responsible for creating {@linkcode NotebookData} so that the editor
|
|
826
|
+
* can create a {@linkcode NotebookDocument}.
|
|
827
|
+
*
|
|
828
|
+
* @see {@link NotebookSerializer}
|
|
829
|
+
*/
|
|
830
|
+
export class NotebookData {
|
|
831
|
+
/**
|
|
832
|
+
* The cell data of this notebook data.
|
|
833
|
+
*/
|
|
834
|
+
cells: NotebookCellData[];
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Arbitrary metadata of notebook data.
|
|
838
|
+
*/
|
|
839
|
+
metadata?: { [key: string]: any };
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Create new notebook data.
|
|
843
|
+
*
|
|
844
|
+
* @param cells An array of cell data.
|
|
845
|
+
*/
|
|
846
|
+
constructor(cells: NotebookCellData[]);
|
|
847
|
+
}
|
|
267
848
|
}
|
|
849
|
+
|
|
@@ -2090,6 +2090,11 @@ declare module 'vscode' {
|
|
|
2090
2090
|
* to filter documents to a [workspace folder](#WorkspaceFolder).
|
|
2091
2091
|
*/
|
|
2092
2092
|
pattern?: GlobPattern;
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* notebook type, like `jupyter-notebook`
|
|
2096
|
+
*/
|
|
2097
|
+
notebookType?: string;
|
|
2093
2098
|
}
|
|
2094
2099
|
|
|
2095
2100
|
/**
|