File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/vs/platform/dnd/browser Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { DragMouseEvent } from 'vs/base/browser/mouseEvent';
8
8
import { coalesce } from 'vs/base/common/arrays' ;
9
9
import { DeferredPromise } from 'vs/base/common/async' ;
10
10
import { VSBuffer } from 'vs/base/common/buffer' ;
11
+ import { ResourceMap } from 'vs/base/common/map' ;
11
12
import { parse } from 'vs/base/common/marshalling' ;
12
13
import { Schemas } from 'vs/base/common/network' ;
13
14
import { isWeb } from 'vs/base/common/platform' ;
@@ -121,7 +122,22 @@ export function extractEditorsDropData(e: DragEvent): Array<IDraggedResourceEdit
121
122
}
122
123
}
123
124
124
- return editors ;
125
+ // Prevent duplicates: it is possible that we end up with the same
126
+ // dragged editor multiple times because multiple data transfers
127
+ // are being used (https://github.com/microsoft/vscode/issues/128925)
128
+
129
+ const coalescedEditors : IDraggedResourceEditorInput [ ] = [ ] ;
130
+ const seen = new ResourceMap < boolean > ( ) ;
131
+ for ( const editor of editors ) {
132
+ if ( ! editor . resource ) {
133
+ coalescedEditors . push ( editor ) ;
134
+ } else if ( ! seen . has ( editor . resource ) ) {
135
+ coalescedEditors . push ( editor ) ;
136
+ seen . set ( editor . resource , true ) ;
137
+ }
138
+ }
139
+
140
+ return coalescedEditors ;
125
141
}
126
142
127
143
export async function extractEditorsAndFilesDropData ( accessor : ServicesAccessor , e : DragEvent ) : Promise < Array < IDraggedResourceEditorInput > > {
You can’t perform that action at this time.
0 commit comments