@@ -58,6 +58,7 @@ import { IEditorResolverService } from 'vs/workbench/services/editor/common/edit
58
58
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite' ;
59
59
import { INotificationService } from 'vs/platform/notification/common/notification' ;
60
60
import { EditorOpenSource } from 'vs/platform/editor/common/editor' ;
61
+ import { ResourceMap } from 'vs/base/common/map' ;
61
62
62
63
interface IExplorerViewColors extends IColorMapping {
63
64
listDropBackground ?: ColorValue | undefined ;
@@ -691,13 +692,31 @@ export class ExplorerView extends ViewPane implements IExplorerView {
691
692
if ( ! previousInput && input . length === 1 && this . configurationService . getValue < IFilesConfiguration > ( ) . explorer . expandSingleFolderWorkspaces ) {
692
693
await this . tree . expand ( input [ 0 ] ) . catch ( ( ) => { } ) ;
693
694
}
694
- if ( Array . isArray ( previousInput ) && previousInput . length < input . length ) {
695
- // Roots added to the explorer -> expand them.
696
- await Promise . all ( input . slice ( previousInput . length ) . map ( async item => {
697
- try {
698
- await this . tree . expand ( item ) ;
699
- } catch ( e ) { }
700
- } ) ) ;
695
+ // TODO@jkearl : Hidden & Probably not needed, remove eventaully.
696
+ const useOldStyle = this . configurationService . getValue < boolean > ( 'explorer.legacyWorkspaceFolderExpandMode' ) ;
697
+ if ( useOldStyle ) {
698
+ if ( Array . isArray ( previousInput ) && previousInput . length < input . length ) {
699
+ // Roots added to the explorer -> expand them.
700
+ await Promise . all ( input . slice ( previousInput . length ) . map ( async item => {
701
+ try {
702
+ await this . tree . expand ( item ) ;
703
+ } catch ( e ) { }
704
+ } ) ) ;
705
+ }
706
+ } else {
707
+ if ( Array . isArray ( previousInput ) ) {
708
+ const previousRoots = new ResourceMap < true > ( ) ;
709
+ previousInput . forEach ( previousRoot => previousRoots . set ( previousRoot . resource , true ) ) ;
710
+
711
+ // Roots added to the explorer -> expand them.
712
+ await Promise . all ( input . map ( async item => {
713
+ if ( ! previousRoots . has ( item . resource ) ) {
714
+ try {
715
+ await this . tree . expand ( item ) ;
716
+ } catch ( e ) { }
717
+ }
718
+ } ) ) ;
719
+ }
701
720
}
702
721
}
703
722
if ( initialInputSetup ) {
0 commit comments