@theia/plugin 1.34.0-next.31 → 1.34.0-next.39

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 +2 -2
  2. package/src/theia.d.ts +199 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.34.0-next.31+255450b22",
3
+ "version": "1.34.0-next.39+34c64e81f",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -32,5 +32,5 @@
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "255450b224eae499d1b130eaf7318ac9659baaa4"
35
+ "gitHead": "34c64e81f040ba2956105c73591669fa7d61db9b"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -3299,6 +3299,35 @@ export module '@theia/plugin' {
3299
3299
  parentTerminal: Terminal;
3300
3300
  }
3301
3301
 
3302
+ /*
3303
+ * Provides a terminal profile for the contributed terminal profile when launched via the UI or
3304
+ * command.
3305
+ */
3306
+ export interface TerminalProfileProvider {
3307
+ /**
3308
+ * Provide the terminal profile.
3309
+ * @param token A cancellation token that indicates the result is no longer needed.
3310
+ * @returns The terminal profile.
3311
+ */
3312
+ provideTerminalProfile(token: CancellationToken): ProviderResult<TerminalProfile>;
3313
+ }
3314
+
3315
+ /**
3316
+ * A terminal profile defines how a terminal will be launched.
3317
+ */
3318
+ export class TerminalProfile {
3319
+ /**
3320
+ * The options that the terminal will launch with.
3321
+ */
3322
+ options: TerminalOptions | ExtensionTerminalOptions;
3323
+
3324
+ /**
3325
+ * Creates a new terminal profile.
3326
+ * @param options The options that the terminal will launch with.
3327
+ */
3328
+ constructor(options: TerminalOptions | ExtensionTerminalOptions);
3329
+ }
3330
+
3302
3331
  /**
3303
3332
  * A file decoration represents metadata that can be rendered with a file.
3304
3333
  */
@@ -5316,6 +5345,12 @@ export module '@theia/plugin' {
5316
5345
  * @return Disposable that unregisters the provider.
5317
5346
  */
5318
5347
  export function registerTerminalLinkProvider(provider: TerminalLinkProvider): Disposable;
5348
+ /**
5349
+ * Registers a provider for a contributed terminal profile.
5350
+ * @param id The ID of the contributed terminal profile.
5351
+ * @param provider The terminal profile provider.
5352
+ */
5353
+ export function registerTerminalProfileProvider(id: string, provider: TerminalProfileProvider): Disposable;
5319
5354
 
5320
5355
  /**
5321
5356
  * Register a file decoration provider.
@@ -5630,6 +5665,11 @@ export module '@theia/plugin' {
5630
5665
  * Whether to show collapse all action or not.
5631
5666
  */
5632
5667
  showCollapseAll?: boolean;
5668
+
5669
+ /**
5670
+ * An optional interface to implement drag and drop in the tree view.
5671
+ */
5672
+ dragAndDropController?: TreeDragAndDropController<T>;
5633
5673
  }
5634
5674
 
5635
5675
  /**
@@ -5668,6 +5708,165 @@ export module '@theia/plugin' {
5668
5708
 
5669
5709
  }
5670
5710
 
5711
+ /**
5712
+ * A file associated with a {@linkcode DataTransferItem}.
5713
+ */
5714
+ export interface DataTransferFile {
5715
+ /**
5716
+ * The name of the file.
5717
+ */
5718
+ readonly name: string;
5719
+
5720
+ /**
5721
+ * The full file path of the file.
5722
+ *
5723
+ * May be `undefined` on web.
5724
+ */
5725
+ readonly uri?: Uri;
5726
+
5727
+ /**
5728
+ * The full file contents of the file.
5729
+ */
5730
+ data(): Thenable<Uint8Array>;
5731
+ }
5732
+
5733
+ /**
5734
+ * Encapsulates data transferred during drag and drop operations.
5735
+ */
5736
+ export class DataTransferItem {
5737
+ /**
5738
+ * Get a string representation of this item.
5739
+ *
5740
+ * If {@linkcode DataTransferItem.value} is an object, this returns the result of json stringifying {@linkcode DataTransferItem.value} value.
5741
+ */
5742
+ asString(): Thenable<string>;
5743
+
5744
+ /**
5745
+ * Try getting the {@link DataTransferFile file} associated with this data transfer item.
5746
+ *
5747
+ * Note that the file object is only valid for the scope of the drag and drop operation.
5748
+ *
5749
+ * @returns The file for the data transfer or `undefined` if the item is either not a file or the
5750
+ * file data cannot be accessed.
5751
+ */
5752
+ asFile(): DataTransferFile | undefined;
5753
+
5754
+ /**
5755
+ * Custom data stored on this item.
5756
+ *
5757
+ * You can use `value` to share data across operations. The original object can be retrieved so long as the extension that
5758
+ * created the `DataTransferItem` runs in the same extension host.
5759
+ */
5760
+ readonly value: any;
5761
+
5762
+ /**
5763
+ * @param value Custom data stored on this item. Can be retrieved using {@linkcode DataTransferItem.value}.
5764
+ */
5765
+ constructor(value: any);
5766
+ }
5767
+
5768
+ /**
5769
+ * A map containing a mapping of the mime type of the corresponding transferred data.
5770
+ *
5771
+ * Drag and drop controllers that implement {@link TreeDragAndDropController.handleDrag `handleDrag`} can add additional mime types to the
5772
+ * data transfer. These additional mime types will only be included in the `handleDrop` when the the drag was initiated from
5773
+ * an element in the same drag and drop controller.
5774
+ */
5775
+ export class DataTransfer implements Iterable<[mimeType: string, item: DataTransferItem]> {
5776
+ /**
5777
+ * Retrieves the data transfer item for a given mime type.
5778
+ *
5779
+ * @param mimeType The mime type to get the data transfer item for, such as `text/plain` or `image/png`.
5780
+ *
5781
+ * Special mime types:
5782
+ * - `text/uri-list` — A string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file,
5783
+ * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number.
5784
+ */
5785
+ get(mimeType: string): DataTransferItem | undefined;
5786
+
5787
+ /**
5788
+ * Sets a mime type to data transfer item mapping.
5789
+ * @param mimeType The mime type to set the data for.
5790
+ * @param value The data transfer item for the given mime type.
5791
+ */
5792
+ set(mimeType: string, value: DataTransferItem): void;
5793
+
5794
+ /**
5795
+ * Allows iteration through the data transfer items.
5796
+ *
5797
+ * @param callbackfn Callback for iteration through the data transfer items.
5798
+ * @param thisArg The `this` context used when invoking the handler function.
5799
+ */
5800
+ forEach(callbackfn: (item: DataTransferItem, mimeType: string, dataTransfer: DataTransfer) => void, thisArg?: any): void;
5801
+
5802
+ /**
5803
+ * Get a new iterator with the `[mime, item]` pairs for each element in this data transfer.
5804
+ */
5805
+ [Symbol.iterator](): IterableIterator<[mimeType: string, item: DataTransferItem]>;
5806
+ }
5807
+
5808
+ /**
5809
+ * Provides support for drag and drop in `TreeView`.
5810
+ */
5811
+ export interface TreeDragAndDropController<T> {
5812
+
5813
+ /**
5814
+ * The mime types that the {@link TreeDragAndDropController.handleDrop `handleDrop`} method of this `DragAndDropController` supports.
5815
+ * This could be well-defined, existing, mime types, and also mime types defined by the extension.
5816
+ *
5817
+ * To support drops from trees, you will need to add the mime type of that tree.
5818
+ * This includes drops from within the same tree.
5819
+ * The mime type of a tree is recommended to be of the format `application/vnd.code.tree.<treeidlowercase>`.
5820
+ *
5821
+ * Use the special `files` mime type to support all types of dropped files {@link DataTransferFile files}, regardless of the file's actual mime type.
5822
+ *
5823
+ * To learn the mime type of a dragged item:
5824
+ * 1. Set up your `DragAndDropController`
5825
+ * 2. Use the Developer: Set Log Level... command to set the level to "Debug"
5826
+ * 3. Open the developer tools and drag the item with unknown mime type over your tree. The mime types will be logged to the developer console
5827
+ *
5828
+ * Note that mime types that cannot be sent to the extension will be omitted.
5829
+ */
5830
+ readonly dropMimeTypes: readonly string[];
5831
+
5832
+ /**
5833
+ * The mime types that the {@link TreeDragAndDropController.handleDrag `handleDrag`} method of this `TreeDragAndDropController` may add to the tree data transfer.
5834
+ * This could be well-defined, existing, mime types, and also mime types defined by the extension.
5835
+ *
5836
+ * The recommended mime type of the tree (`application/vnd.code.tree.<treeidlowercase>`) will be automatically added.
5837
+ */
5838
+ readonly dragMimeTypes: readonly string[];
5839
+
5840
+ /**
5841
+ * When the user starts dragging items from this `DragAndDropController`, `handleDrag` will be called.
5842
+ * Extensions can use `handleDrag` to add their {@link DataTransferItem `DataTransferItem`} items to the drag and drop.
5843
+ *
5844
+ * When the items are dropped on **another tree item** in **the same tree**, your `DataTransferItem` objects
5845
+ * will be preserved. Use the recommended mime type for the tree (`application/vnd.code.tree.<treeidlowercase>`) to add
5846
+ * tree objects in a data transfer. See the documentation for `DataTransferItem` for how best to take advantage of this.
5847
+ *
5848
+ * To add a data transfer item that can be dragged into the editor, use the application specific mime type "text/uri-list".
5849
+ * The data for "text/uri-list" should be a string with `toString()`ed Uris separated by newlines. To specify a cursor position in the file,
5850
+ * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number.
5851
+ *
5852
+ * @param source The source items for the drag and drop operation.
5853
+ * @param dataTransfer The data transfer associated with this drag.
5854
+ * @param token A cancellation token indicating that drag has been cancelled.
5855
+ */
5856
+ handleDrag?(source: readonly T[], dataTransfer: DataTransfer, token: CancellationToken): Thenable<void> | void;
5857
+
5858
+ /**
5859
+ * Called when a drag and drop action results in a drop on the tree that this `DragAndDropController` belongs to.
5860
+ *
5861
+ * Extensions should fire {@link TreeDataProvider.onDidChangeTreeData onDidChangeTreeData} for any elements that need to be refreshed.
5862
+ *
5863
+ * @param dataTransfer The data transfer items of the source of the drag.
5864
+ * @param target The target tree element that the drop is occurring on. When undefined, the target is the root.
5865
+ * @param token A cancellation token indicating that the drop has been cancelled.
5866
+ */
5867
+ handleDrop?(target: T | undefined, dataTransfer: DataTransfer, token: CancellationToken): Thenable<void> | void;
5868
+ }
5869
+
5671
5870
  /**
5672
5871
  * Represents a Tree view
5673
5872
  */