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';
88import { coalesce } from 'vs/base/common/arrays' ;
99import { DeferredPromise } from 'vs/base/common/async' ;
1010import { VSBuffer } from 'vs/base/common/buffer' ;
11+ import { ResourceMap } from 'vs/base/common/map' ;
1112import { parse } from 'vs/base/common/marshalling' ;
1213import { Schemas } from 'vs/base/common/network' ;
1314import { isWeb } from 'vs/base/common/platform' ;
@@ -121,7 +122,22 @@ export function extractEditorsDropData(e: DragEvent): Array<IDraggedResourceEdit
121122 }
122123 }
123124
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 ;
125141}
126142
127143export async function extractEditorsAndFilesDropData ( accessor : ServicesAccessor , e : DragEvent ) : Promise < Array < IDraggedResourceEditorInput > > {
You can’t perform that action at this time.
0 commit comments