Skip to content

Commit 0ccec43

Browse files
authored
Some explorer commands should ignore nested children (microsoft#159563)
Add ability to ingore nested children
1 parent 9332731 commit 0ccec43

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/vs/workbench/contrib/files/browser/explorerService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ export class ExplorerService implements IExplorerService {
147147
this.view = contextProvider;
148148
}
149149

150-
getContext(respectMultiSelection: boolean): ExplorerItem[] {
150+
getContext(respectMultiSelection: boolean, ignoreNestedChildren: boolean = false): ExplorerItem[] {
151151
if (!this.view) {
152152
return [];
153153
}
154154

155155
const items = new Set<ExplorerItem>(this.view.getContext(respectMultiSelection));
156156
items.forEach(item => {
157157
try {
158-
if (respectMultiSelection && this.view?.isItemCollapsed(item) && item.nestedChildren) {
158+
if (respectMultiSelection && !ignoreNestedChildren && this.view?.isItemCollapsed(item) && item.nestedChildren) {
159159
for (const child of item.nestedChildren) {
160160
items.add(child);
161161
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface IExplorerService {
2323
readonly roots: ExplorerItem[];
2424
readonly sortOrderConfiguration: ISortOrderConfiguration;
2525

26-
getContext(respectMultiSelection: boolean): ExplorerItem[];
26+
getContext(respectMultiSelection: boolean, ignoreNestedChildren?: boolean): ExplorerItem[];
2727
hasViewFocus(): boolean;
2828
setEditable(stat: ExplorerItem, data: IEditableData | null): Promise<void>;
2929
getEditable(): { stat: ExplorerItem; data: IEditableData } | undefined;
@@ -105,7 +105,7 @@ export function getMultiSelectedResources(resource: URI | object | undefined, li
105105
// Explorer
106106
if (list instanceof AsyncDataTree && list.getFocus().every(item => item instanceof ExplorerItem)) {
107107
// Explorer
108-
const context = explorerService.getContext(true);
108+
const context = explorerService.getContext(true, true);
109109
if (context.length) {
110110
return context.map(c => c.resource);
111111
}

0 commit comments

Comments
 (0)