Skip to content

Commit 60091d4

Browse files
authored
fix: Cannot drag from VS Code's file explorer to Java Project explorer (#661)
1 parent 3ee3afd commit 60091d4

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"explorer"
1313
],
1414
"engines": {
15-
"vscode": "^1.66.0"
15+
"vscode": "^1.69.0"
1616
},
1717
"repository": {
1818
"type": "git",
@@ -648,7 +648,7 @@
648648
"@types/mocha": "^9.1.1",
649649
"@types/node": "^14.18.21",
650650
"@types/semver": "^7.3.10",
651-
"@types/vscode": "1.66.0",
651+
"@types/vscode": "1.69.0",
652652
"@vscode/test-electron": "^2.1.5",
653653
"copy-webpack-plugin": "^9.1.0",
654654
"glob": "^7.2.3",

src/views/DragAndDropController.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ export class DragAndDropController implements TreeDragAndDropController<Explorer
4848
return;
4949
}
5050

51-
let uriList: string[] = [];
52-
// an undefined value will be contained with the key 'text/uri-list', so here
53-
// we iterate all the entries to get the uri list.
54-
// see: https://github.com/microsoft/vscode/issues/152031
55-
dataTransfer.forEach((value: DataTransferItem, key: string) => {
56-
if (key === Explorer.Mime.TextUriList && value.value) {
57-
uriList.push(...(value.value as string).split("\n"));
58-
}
59-
});
51+
const uris: string | undefined = await dataTransfer.get(Explorer.Mime.TextUriList)?.asString();
52+
if (!uris) {
53+
return;
54+
}
6055

61-
uriList = uriList.map(u => {
56+
const uriList: string[] = uris.split(/\r?\n/g).map(u => {
6257
try {
6358
const uri = Uri.parse(u, true /* strict */);
6459
if (uri.scheme !== "file") {

0 commit comments

Comments
 (0)