Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/vs
diff options
context:
space:
mode:
authorMatt Bierner <matb@microsoft.com>2022-06-07 18:06:00 +0300
committerGitHub <noreply@github.com>2022-06-07 18:06:00 +0300
commit75a6ddc8626b831f01f91f9f60f27de3d5bb6f38 (patch)
tree294fc609fccd0fca919f6e622e823f68a0ec8308 /src/vs
parent9daa6e91253350286f23b218afad8df72f283611 (diff)
Add DataTransferItem.kind (#151384)
Fixes #150963 The new `.kind` property makes it easier to tell the type of a data transfer item
Diffstat (limited to 'src/vs')
-rw-r--r--src/vs/workbench/api/common/extHost.api.impl.ts1
-rw-r--r--src/vs/workbench/api/common/extHostTypeConverters.ts2
-rw-r--r--src/vs/workbench/api/common/extHostTypes.ts8
3 files changed, 11 insertions, 0 deletions
diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts
index 7d6ec043a9a..e649eb3a21a 100644
--- a/src/vs/workbench/api/common/extHost.api.impl.ts
+++ b/src/vs/workbench/api/common/extHost.api.impl.ts
@@ -1330,6 +1330,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
TextSearchCompleteMessageType: TextSearchCompleteMessageType,
DataTransfer: extHostTypes.DataTransfer,
DataTransferItem: extHostTypes.DataTransferItem,
+ DataTransferItemKind: extHostTypes.DataTransferItemKind,
CoveredCount: extHostTypes.CoveredCount,
FileCoverage: extHostTypes.FileCoverage,
StatementCoverage: extHostTypes.StatementCoverage,
diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts
index 18d71be8a26..f008c948af3 100644
--- a/src/vs/workbench/api/common/extHostTypeConverters.ts
+++ b/src/vs/workbench/api/common/extHostTypeConverters.ts
@@ -1965,6 +1965,8 @@ export namespace DataTransferItem {
const file = item.fileData;
if (file) {
return new class extends types.DataTransferItem {
+ override get kind() { return types.DataTransferItemKind.File; }
+
override asFile(): vscode.DataTransferFile {
return {
name: file.name,
diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts
index b5e2cd04ef9..97453151e46 100644
--- a/src/vs/workbench/api/common/extHostTypes.ts
+++ b/src/vs/workbench/api/common/extHostTypes.ts
@@ -2438,8 +2438,16 @@ export enum TreeItemCollapsibleState {
Expanded = 2
}
+export enum DataTransferItemKind {
+ String = 1,
+ File = 2,
+}
+
@es5ClassCompat
export class DataTransferItem {
+
+ get kind(): DataTransferItemKind { return DataTransferItemKind.String; }
+
async asString(): Promise<string> {
return typeof this.value === 'string' ? this.value : JSON.stringify(this.value);
}