Skip to content

Commit 528b3ea

Browse files
author
Jackson Kearl
committed
1 parent a93f7be commit 528b3ea

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/vs/workbench/contrib/files/browser/views/explorerView.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { IEditorResolverService } from 'vs/workbench/services/editor/common/edit
5858
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
5959
import { INotificationService } from 'vs/platform/notification/common/notification';
6060
import { EditorOpenSource } from 'vs/platform/editor/common/editor';
61+
import { ResourceMap } from 'vs/base/common/map';
6162

6263
interface IExplorerViewColors extends IColorMapping {
6364
listDropBackground?: ColorValue | undefined;
@@ -691,13 +692,31 @@ export class ExplorerView extends ViewPane implements IExplorerView {
691692
if (!previousInput && input.length === 1 && this.configurationService.getValue<IFilesConfiguration>().explorer.expandSingleFolderWorkspaces) {
692693
await this.tree.expand(input[0]).catch(() => { });
693694
}
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+
}
701720
}
702721
}
703722
if (initialInputSetup) {

0 commit comments

Comments
 (0)