@@ -67,6 +67,7 @@ export class OpenEditorsView extends ViewPane {
67
67
private dirtyCountElement ! : HTMLElement ;
68
68
private listRefreshScheduler : RunOnceScheduler | undefined ;
69
69
private structuralRefreshDelay : number ;
70
+ private dnd : OpenEditorsDragAndDrop | undefined ;
70
71
private list : WorkbenchList < OpenEditor | IEditorGroup > | undefined ;
71
72
private listLabels : ResourceLabels | undefined ;
72
73
private needsRefresh = false ;
@@ -198,13 +199,16 @@ export class OpenEditorsView extends ViewPane {
198
199
if ( this . listLabels ) {
199
200
this . listLabels . clear ( ) ;
200
201
}
202
+
203
+ this . dnd = new OpenEditorsDragAndDrop ( this . sortOrder , this . instantiationService , this . editorGroupService ) ;
204
+
201
205
this . listLabels = this . instantiationService . createInstance ( ResourceLabels , { onDidChangeVisibility : this . onDidChangeBodyVisibility } ) ;
202
206
this . list = this . instantiationService . createInstance ( WorkbenchList , 'OpenEditors' , container , delegate , [
203
207
new EditorGroupRenderer ( this . keybindingService , this . instantiationService ) ,
204
208
new OpenEditorRenderer ( this . listLabels , this . instantiationService , this . keybindingService , this . configurationService )
205
209
] , {
206
210
identityProvider : { getId : ( element : OpenEditor | IEditorGroup ) => element instanceof OpenEditor ? element . getId ( ) : element . id . toString ( ) } ,
207
- dnd : new OpenEditorsDragAndDrop ( this . instantiationService , this . editorGroupService ) ,
211
+ dnd : this . dnd ,
208
212
overrideStyles : {
209
213
listBackground : this . getBackgroundColor ( )
210
214
} ,
@@ -448,6 +452,9 @@ export class OpenEditorsView extends ViewPane {
448
452
// Trigger a 'repaint' when decoration settings change or the sort order changed
449
453
if ( event . affectsConfiguration ( 'explorer.decorations' ) || event . affectsConfiguration ( 'explorer.openEditors.sortOrder' ) ) {
450
454
this . sortOrder = this . configurationService . getValue ( 'explorer.openEditors.sortOrder' ) ;
455
+ if ( this . dnd ) {
456
+ this . dnd . sortOrder = this . sortOrder ;
457
+ }
451
458
this . listRefreshScheduler ?. schedule ( ) ;
452
459
}
453
460
}
@@ -672,10 +679,18 @@ class OpenEditorRenderer implements IListRenderer<OpenEditor, IOpenEditorTemplat
672
679
673
680
class OpenEditorsDragAndDrop implements IListDragAndDrop < OpenEditor | IEditorGroup > {
674
681
682
+ private _sortOrder : 'editorOrder' | 'alphabetical' | 'fullPath' ;
683
+ public set sortOrder ( value : 'editorOrder' | 'alphabetical' | 'fullPath' ) {
684
+ this . _sortOrder = value ;
685
+ }
686
+
675
687
constructor (
688
+ sortOrder : 'editorOrder' | 'alphabetical' | 'fullPath' ,
676
689
private instantiationService : IInstantiationService ,
677
690
private editorGroupService : IEditorGroupsService
678
- ) { }
691
+ ) {
692
+ this . _sortOrder = sortOrder ;
693
+ }
679
694
680
695
@memoize private get dropHandler ( ) : ResourcesDropHandler {
681
696
return this . instantiationService . createInstance ( ResourcesDropHandler , { allowWorkspaceOpen : false } ) ;
@@ -724,6 +739,16 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
724
739
}
725
740
}
726
741
742
+ if ( this . _sortOrder !== 'editorOrder' ) {
743
+ if ( data instanceof ElementsDragAndDropData ) {
744
+ // No reordering supported when sorted
745
+ return false ;
746
+ } else {
747
+ // Allow droping files to open them
748
+ return { accept : true , effect : { type : ListDragOverEffectType . Move } , feedback : [ - 1 ] } as IListDragOverReaction ;
749
+ }
750
+ }
751
+
727
752
let dropEffectPosition : ListDragOverEffectPosition | undefined = undefined ;
728
753
switch ( targetSector ) {
729
754
case ListViewTargetSector . TOP :
0 commit comments