@theia/plugin 1.34.0 → 1.35.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/theia.d.ts +161 -47
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -27,10 +27,10 @@
27
27
  "watch": "theiaext watch"
28
28
  },
29
29
  "devDependencies": {
30
- "@theia/ext-scripts": "1.34.0"
30
+ "@theia/ext-scripts": "1.35.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "a8c403b103829a1b8b092ce741ef3826804f773b"
35
+ "gitHead": "5b1e4f9b913cf1b0d27acd4bc435cb2570f164d8"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -5653,6 +5653,103 @@ export module '@theia/plugin' {
5653
5653
  report(value: T): void;
5654
5654
  }
5655
5655
 
5656
+ /**
5657
+ * A file associated with a {@linkcode DataTransferItem}.
5658
+ */
5659
+ export interface DataTransferFile {
5660
+ /**
5661
+ * The name of the file.
5662
+ */
5663
+ readonly name: string;
5664
+
5665
+ /**
5666
+ * The full file path of the file.
5667
+ *
5668
+ * May be `undefined` on web.
5669
+ */
5670
+ readonly uri?: Uri;
5671
+
5672
+ /**
5673
+ * The full file contents of the file.
5674
+ */
5675
+ data(): Thenable<Uint8Array>;
5676
+ }
5677
+
5678
+ /**
5679
+ * Encapsulates data transferred during drag and drop operations.
5680
+ */
5681
+ export class DataTransferItem {
5682
+ /**
5683
+ * Get a string representation of this item.
5684
+ *
5685
+ * If {@linkcode DataTransferItem.value} is an object, this returns the result of json stringifying {@linkcode DataTransferItem.value} value.
5686
+ */
5687
+ asString(): Thenable<string>;
5688
+
5689
+ /**
5690
+ * Try getting the {@link DataTransferFile file} associated with this data transfer item.
5691
+ *
5692
+ * Note that the file object is only valid for the scope of the drag and drop operation.
5693
+ *
5694
+ * @returns The file for the data transfer or `undefined` if the item is either not a file or the
5695
+ * file data cannot be accessed.
5696
+ */
5697
+ asFile(): DataTransferFile | undefined;
5698
+
5699
+ /**
5700
+ * Custom data stored on this item.
5701
+ *
5702
+ * You can use `value` to share data across operations. The original object can be retrieved so long as the extension that
5703
+ * created the `DataTransferItem` runs in the same extension host.
5704
+ */
5705
+ readonly value: any;
5706
+
5707
+ /**
5708
+ * @param value Custom data stored on this item. Can be retrieved using {@linkcode DataTransferItem.value}.
5709
+ */
5710
+ constructor(value: any);
5711
+ }
5712
+
5713
+ /**
5714
+ * A map containing a mapping of the mime type of the corresponding transferred data.
5715
+ *
5716
+ * Drag and drop controllers that implement {@link TreeDragAndDropController.handleDrag `handleDrag`} can add additional mime types to the
5717
+ * data transfer. These additional mime types will only be included in the `handleDrop` when the the drag was initiated from
5718
+ * an element in the same drag and drop controller.
5719
+ */
5720
+ export class DataTransfer implements Iterable<[mimeType: string, item: DataTransferItem]> {
5721
+ /**
5722
+ * Retrieves the data transfer item for a given mime type.
5723
+ *
5724
+ * @param mimeType The mime type to get the data transfer item for, such as `text/plain` or `image/png`.
5725
+ *
5726
+ * Special mime types:
5727
+ * - `text/uri-list` — A string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file,
5728
+ * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number.
5729
+ */
5730
+ get(mimeType: string): DataTransferItem | undefined;
5731
+
5732
+ /**
5733
+ * Sets a mime type to data transfer item mapping.
5734
+ * @param mimeType The mime type to set the data for.
5735
+ * @param value The data transfer item for the given mime type.
5736
+ */
5737
+ set(mimeType: string, value: DataTransferItem): void;
5738
+
5739
+ /**
5740
+ * Allows iteration through the data transfer items.
5741
+ *
5742
+ * @param callbackfn Callback for iteration through the data transfer items.
5743
+ * @param thisArg The `this` context used when invoking the handler function.
5744
+ */
5745
+ forEach(callbackfn: (item: DataTransferItem, mimeType: string, dataTransfer: DataTransfer) => void, thisArg?: any): void;
5746
+
5747
+ /**
5748
+ * Get a new iterator with the `[mime, item]` pairs for each element in this data transfer.
5749
+ */
5750
+ [Symbol.iterator](): IterableIterator<[mimeType: string, item: DataTransferItem]>;
5751
+ }
5752
+
5656
5753
  /**
5657
5754
  * Options for creating a {@link TreeView TreeView}
5658
5755
  */
@@ -7108,9 +7205,10 @@ export module '@theia/plugin' {
7108
7205
  * not be attempted, when a single edit fails.
7109
7206
  *
7110
7207
  * @param edit A workspace edit.
7208
+ * @param metadata Optional {@link WorkspaceEditMetadata metadata} for the edit.
7111
7209
  * @return A thenable that resolves when the edit could be applied.
7112
7210
  */
7113
- export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
7211
+ export function applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Thenable<boolean>;
7114
7212
 
7115
7213
  /**
7116
7214
  * Register a filesystem provider for a given scheme, e.g. `ftp`.
@@ -9652,6 +9750,16 @@ export module '@theia/plugin' {
9652
9750
  iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
9653
9751
  }
9654
9752
 
9753
+ /**
9754
+ * Additional data about a workspace edit.
9755
+ */
9756
+ export interface WorkspaceEditMetadata {
9757
+ /**
9758
+ * Signal to the editor that this edit is a refactoring.
9759
+ */
9760
+ isRefactoring?: boolean;
9761
+ }
9762
+
9655
9763
  /**
9656
9764
  * A workspace edit is a collection of textual and files changes for
9657
9765
  * multiple resources and documents.
@@ -10347,6 +10455,16 @@ export module '@theia/plugin' {
10347
10455
  */
10348
10456
  export function registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable;
10349
10457
 
10458
+ /**
10459
+ * Registers a new {@link DocumentDropEditProvider}.
10460
+ *
10461
+ * @param selector A selector that defines the documents this provider applies to.
10462
+ * @param provider A drop provider.
10463
+ *
10464
+ * @return A {@link Disposable} that unregisters this provider when disposed of.
10465
+ */
10466
+ export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider): Disposable;
10467
+
10350
10468
  /**
10351
10469
  * Register a declaration provider.
10352
10470
  *
@@ -13208,6 +13326,48 @@ export module '@theia/plugin' {
13208
13326
  provideLinkedEditingRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
13209
13327
  }
13210
13328
 
13329
+ /**
13330
+ * An edit operation applied {@link DocumentDropEditProvider on drop}.
13331
+ */
13332
+ export class DocumentDropEdit {
13333
+ /**
13334
+ * The text or snippet to insert at the drop location.
13335
+ */
13336
+ insertText: string | SnippetString;
13337
+
13338
+ /**
13339
+ * An optional additional edit to apply on drop.
13340
+ */
13341
+ additionalEdit?: WorkspaceEdit;
13342
+
13343
+ /**
13344
+ * @param insertText The text or snippet to insert at the drop location.
13345
+ */
13346
+ constructor(insertText: string | SnippetString);
13347
+ }
13348
+
13349
+ /**
13350
+ * Provider which handles dropping of resources into a text editor.
13351
+ *
13352
+ * This allows users to drag and drop resources (including resources from external apps) into the editor. While dragging
13353
+ * and dropping files, users can hold down `shift` to drop the file into the editor instead of opening it.
13354
+ * Requires `editor.dropIntoEditor.enabled` to be on.
13355
+ */
13356
+ export interface DocumentDropEditProvider {
13357
+ /**
13358
+ * Provide edits which inserts the content being dragged and dropped into the document.
13359
+ *
13360
+ * @param document The document in which the drop occurred.
13361
+ * @param position The position in the document where the drop occurred.
13362
+ * @param dataTransfer A {@link DataTransfer} object that holds data about what is being dragged and dropped.
13363
+ * @param token A cancellation token.
13364
+ *
13365
+ * @return A {@link DocumentDropEdit} or a thenable that resolves to such. The lack of a result can be
13366
+ * signaled by returning `undefined` or `null`.
13367
+ */
13368
+ provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<DocumentDropEdit>;
13369
+ }
13370
+
13211
13371
  /**
13212
13372
  * Represents a session of a currently logged in user.
13213
13373
  */
@@ -13474,13 +13634,11 @@ export module '@theia/plugin' {
13474
13634
  export class TabInputText {
13475
13635
  /**
13476
13636
  * The uri represented by the tab.
13477
- * @stubbed
13478
13637
  */
13479
13638
  readonly uri: Uri;
13480
13639
  /**
13481
13640
  * Constructs a text tab input with the given URI.
13482
13641
  * @param uri The URI of the tab.
13483
- * @stubbed
13484
13642
  */
13485
13643
  constructor(uri: Uri);
13486
13644
  }
@@ -13492,19 +13650,16 @@ export module '@theia/plugin' {
13492
13650
  export class TabInputTextDiff {
13493
13651
  /**
13494
13652
  * The uri of the original text resource.
13495
- * @stubbed
13496
13653
  */
13497
13654
  readonly original: Uri;
13498
13655
  /**
13499
13656
  * The uri of the modified text resource.
13500
- * @stubbed
13501
13657
  */
13502
13658
  readonly modified: Uri;
13503
13659
  /**
13504
13660
  * Constructs a new text diff tab input with the given URIs.
13505
13661
  * @param original The uri of the original text resource.
13506
13662
  * @param modified The uri of the modified text resource.
13507
- * @stubbed
13508
13663
  */
13509
13664
  constructor(original: Uri, modified: Uri);
13510
13665
  }
@@ -13515,19 +13670,16 @@ export module '@theia/plugin' {
13515
13670
  export class TabInputCustom {
13516
13671
  /**
13517
13672
  * The uri that the tab is representing.
13518
- * @stubbed
13519
13673
  */
13520
13674
  readonly uri: Uri;
13521
13675
  /**
13522
13676
  * The type of custom editor.
13523
- * @stubbed
13524
13677
  */
13525
13678
  readonly viewType: string;
13526
13679
  /**
13527
13680
  * Constructs a custom editor tab input.
13528
13681
  * @param uri The uri of the tab.
13529
13682
  * @param viewType The viewtype of the custom editor.
13530
- * @stubbed
13531
13683
  */
13532
13684
  constructor(uri: Uri, viewType: string);
13533
13685
  }
@@ -13538,13 +13690,11 @@ export module '@theia/plugin' {
13538
13690
  export class TabInputWebview {
13539
13691
  /**
13540
13692
  * The type of webview. Maps to WebviewPanel's viewType
13541
- * @stubbed
13542
13693
  */
13543
13694
  readonly viewType: string;
13544
13695
  /**
13545
13696
  * Constructs a webview tab input with the given view type.
13546
13697
  * @param viewType The type of webview. Maps to WebviewPanel's viewType
13547
- * @stubbed
13548
13698
  */
13549
13699
  constructor(viewType: string);
13550
13700
  }
@@ -13555,19 +13705,16 @@ export module '@theia/plugin' {
13555
13705
  export class TabInputNotebook {
13556
13706
  /**
13557
13707
  * The uri that the tab is representing.
13558
- * @stubbed
13559
13708
  */
13560
13709
  readonly uri: Uri;
13561
13710
  /**
13562
13711
  * The type of notebook. Maps to NotebookDocuments's notebookType
13563
- * @stubbed
13564
13712
  */
13565
13713
  readonly notebookType: string;
13566
13714
  /**
13567
13715
  * Constructs a new tab input for a notebook.
13568
13716
  * @param uri The uri of the notebook.
13569
13717
  * @param notebookType The type of notebook. Maps to NotebookDocuments's notebookType
13570
- * @stubbed
13571
13718
  */
13572
13719
  constructor(uri: Uri, notebookType: string);
13573
13720
  }
@@ -13578,17 +13725,14 @@ export module '@theia/plugin' {
13578
13725
  export class TabInputNotebookDiff {
13579
13726
  /**
13580
13727
  * The uri of the original notebook.
13581
- * @stubbed
13582
13728
  */
13583
13729
  readonly original: Uri;
13584
13730
  /**
13585
13731
  * The uri of the modified notebook.
13586
- * @stubbed
13587
13732
  */
13588
13733
  readonly modified: Uri;
13589
13734
  /**
13590
13735
  * The type of notebook. Maps to NotebookDocuments's notebookType
13591
- * @stubbed
13592
13736
  */
13593
13737
  readonly notebookType: string;
13594
13738
  /**
@@ -13596,7 +13740,6 @@ export module '@theia/plugin' {
13596
13740
  * @param original The uri of the original unmodified notebook.
13597
13741
  * @param modified The uri of the modified notebook.
13598
13742
  * @param notebookType The type of notebook. Maps to NotebookDocuments's notebookType
13599
- * @stubbed
13600
13743
  */
13601
13744
  constructor(original: Uri, modified: Uri, notebookType: string);
13602
13745
  }
@@ -13607,7 +13750,6 @@ export module '@theia/plugin' {
13607
13750
  export class TabInputTerminal {
13608
13751
  /**
13609
13752
  * Constructs a terminal tab input.
13610
- * @stubbed
13611
13753
  */
13612
13754
  constructor();
13613
13755
  }
@@ -13621,45 +13763,38 @@ export module '@theia/plugin' {
13621
13763
 
13622
13764
  /**
13623
13765
  * The text displayed on the tab.
13624
- * @stubbed
13625
13766
  */
13626
13767
  readonly label: string;
13627
13768
 
13628
13769
  /**
13629
13770
  * The group which the tab belongs to.
13630
- * @stubbed
13631
13771
  */
13632
13772
  readonly group: TabGroup;
13633
13773
 
13634
13774
  /**
13635
13775
  * Defines the structure of the tab i.e. text, notebook, custom, etc.
13636
13776
  * Resource and other useful properties are defined on the tab kind.
13637
- * @stubbed
13638
13777
  */
13639
13778
  readonly input: TabInputText | TabInputTextDiff | TabInputCustom | TabInputWebview | TabInputNotebook | TabInputNotebookDiff | TabInputTerminal | unknown;
13640
13779
 
13641
13780
  /**
13642
13781
  * Whether or not the tab is currently active.
13643
13782
  * This is dictated by being the selected tab in the group.
13644
- * @stubbed
13645
13783
  */
13646
13784
  readonly isActive: boolean;
13647
13785
 
13648
13786
  /**
13649
13787
  * Whether or not the dirty indicator is present on the tab.
13650
- * @stubbed
13651
13788
  */
13652
13789
  readonly isDirty: boolean;
13653
13790
 
13654
13791
  /**
13655
13792
  * Whether or not the tab is pinned (pin icon is present).
13656
- * @stubbed
13657
13793
  */
13658
13794
  readonly isPinned: boolean;
13659
13795
 
13660
13796
  /**
13661
13797
  * Whether or not the tab is in preview mode.
13662
- * @stubbed
13663
13798
  */
13664
13799
  readonly isPreview: boolean;
13665
13800
  }
@@ -13670,18 +13805,15 @@ export module '@theia/plugin' {
13670
13805
  export interface TabChangeEvent {
13671
13806
  /**
13672
13807
  * The tabs that have been opened.
13673
- * @stubbed
13674
13808
  */
13675
13809
  readonly opened: readonly Tab[];
13676
13810
  /**
13677
13811
  * The tabs that have been closed.
13678
- * @stubbed
13679
13812
  */
13680
13813
  readonly closed: readonly Tab[];
13681
13814
  /**
13682
13815
  * Tabs that have changed, e.g have changed
13683
13816
  * their {@link Tab.isActive active} state.
13684
- * @stubbed
13685
13817
  */
13686
13818
  readonly changed: readonly Tab[];
13687
13819
  }
@@ -13692,18 +13824,15 @@ export module '@theia/plugin' {
13692
13824
  export interface TabGroupChangeEvent {
13693
13825
  /**
13694
13826
  * Tab groups that have been opened.
13695
- * @stubbed
13696
13827
  */
13697
13828
  readonly opened: readonly TabGroup[];
13698
13829
  /**
13699
13830
  * Tab groups that have been closed.
13700
- * @stubbed
13701
13831
  */
13702
13832
  readonly closed: readonly TabGroup[];
13703
13833
  /**
13704
13834
  * Tab groups that have changed, e.g have changed
13705
13835
  * their {@link TabGroup.isActive active} state.
13706
- * @stubbed
13707
13836
  */
13708
13837
  readonly changed: readonly TabGroup[];
13709
13838
  }
@@ -13719,13 +13848,11 @@ export module '@theia/plugin' {
13719
13848
  * groups can have an {@link TabGroup.aciveTab active tab}.
13720
13849
  *
13721
13850
  * @see {@link Tab.isActive}
13722
- * @stubbed
13723
13851
  */
13724
13852
  readonly isActive: boolean;
13725
13853
 
13726
13854
  /**
13727
13855
  * The view column of the group.
13728
- * @stubbed
13729
13856
  */
13730
13857
  readonly viewColumn: ViewColumn;
13731
13858
 
@@ -13734,14 +13861,12 @@ export module '@theia/plugin' {
13734
13861
  * being rendered.
13735
13862
  *
13736
13863
  * *Note* that there can be one active tab per group but there can only be one {@link TabGroups.activeTabGroup active group}.
13737
- * @stubbed
13738
13864
  */
13739
13865
  readonly activeTab: Tab | undefined;
13740
13866
 
13741
13867
  /**
13742
13868
  * The list of tabs contained within the group.
13743
13869
  * This can be empty if the group has no tabs open.
13744
- * @stubbed
13745
13870
  */
13746
13871
  readonly tabs: readonly Tab[];
13747
13872
  }
@@ -13752,25 +13877,21 @@ export module '@theia/plugin' {
13752
13877
  export interface TabGroups {
13753
13878
  /**
13754
13879
  * All the groups within the group container.
13755
- * @stubbed
13756
13880
  */
13757
13881
  readonly all: readonly TabGroup[];
13758
13882
 
13759
13883
  /**
13760
13884
  * The currently active group.
13761
- * @stubbed
13762
13885
  */
13763
13886
  readonly activeTabGroup: TabGroup;
13764
13887
 
13765
13888
  /**
13766
13889
  * An {@link Event event} which fires when {@link TabGroup tab groups} have changed.
13767
- * @stubbed
13768
13890
  */
13769
13891
  readonly onDidChangeTabGroups: Event<TabGroupChangeEvent>;
13770
13892
 
13771
13893
  /**
13772
13894
  * An {@link Event event} which fires when {@link Tab tabs} have changed.
13773
- * @stubbed
13774
13895
  */
13775
13896
  readonly onDidChangeTabs: Event<TabChangeEvent>;
13776
13897
 
@@ -13782,7 +13903,6 @@ export module '@theia/plugin' {
13782
13903
  * @param tab The tab to close.
13783
13904
  * @param preserveFocus When `true` focus will remain in its current position. If `false` it will jump to the next tab.
13784
13905
  * @returns A promise that resolves to `true` when all tabs have been closed.
13785
- * @stubbed
13786
13906
  */
13787
13907
  close(tab: Tab | readonly Tab[], preserveFocus?: boolean): Thenable<boolean>;
13788
13908
 
@@ -13792,7 +13912,6 @@ export module '@theia/plugin' {
13792
13912
  * @param tabGroup The tab group to close.
13793
13913
  * @param preserveFocus When `true` focus will remain in its current position.
13794
13914
  * @returns A promise that resolves to `true` when all tab groups have been closed.
13795
- * @stubbed
13796
13915
  */
13797
13916
  close(tabGroup: TabGroup | readonly TabGroup[], preserveFocus?: boolean): Thenable<boolean>;
13798
13917
  }
@@ -13933,7 +14052,6 @@ export module '@theia/plugin' {
13933
14052
 
13934
14053
  /**
13935
14054
  * The {@link NotebookDocument notebook} that contains this cell.
13936
- * @stubbed
13937
14055
  */
13938
14056
  readonly notebook: NotebookDocument;
13939
14057
 
@@ -13994,26 +14112,22 @@ export module '@theia/plugin' {
13994
14112
  /**
13995
14113
  * The version number of this notebook (it will strictly increase after each
13996
14114
  * change, including undo/redo).
13997
- * @stubbed
13998
14115
  */
13999
14116
  readonly version: number;
14000
14117
 
14001
14118
  /**
14002
14119
  * `true` if there are unpersisted changes.
14003
- * @stubbed
14004
14120
  */
14005
14121
  readonly isDirty: boolean;
14006
14122
 
14007
14123
  /**
14008
14124
  * Is this notebook representing an untitled file which has not been saved yet.
14009
- * @stubbed
14010
14125
  */
14011
14126
  readonly isUntitled: boolean;
14012
14127
 
14013
14128
  /**
14014
14129
  * `true` if the notebook has been closed. A closed notebook isn't synchronized anymore
14015
14130
  * and won't be re-used when the same resource is opened again.
14016
- * @stubbed
14017
14131
  */
14018
14132
  readonly isClosed: boolean;
14019
14133