Some explorer commands should ignore nested children (#159563)

Add ability to ingore nested children
This commit is contained in:
Logan Ramos 2022-08-30 10:10:12 -04:00 committed by GitHub
parent 93327316c0
commit 0ccec43747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -147,7 +147,7 @@ export class ExplorerService implements IExplorerService {
this.view = contextProvider;
}
getContext(respectMultiSelection: boolean): ExplorerItem[] {
getContext(respectMultiSelection: boolean, ignoreNestedChildren: boolean = false): ExplorerItem[] {
if (!this.view) {
return [];
}
@ -155,7 +155,7 @@ export class ExplorerService implements IExplorerService {
const items = new Set<ExplorerItem>(this.view.getContext(respectMultiSelection));
items.forEach(item => {
try {
if (respectMultiSelection && this.view?.isItemCollapsed(item) && item.nestedChildren) {
if (respectMultiSelection && !ignoreNestedChildren && this.view?.isItemCollapsed(item) && item.nestedChildren) {
for (const child of item.nestedChildren) {
items.add(child);
}

View File

@ -23,7 +23,7 @@ export interface IExplorerService {
readonly roots: ExplorerItem[];
readonly sortOrderConfiguration: ISortOrderConfiguration;
getContext(respectMultiSelection: boolean): ExplorerItem[];
getContext(respectMultiSelection: boolean, ignoreNestedChildren?: boolean): ExplorerItem[];
hasViewFocus(): boolean;
setEditable(stat: ExplorerItem, data: IEditableData | null): Promise<void>;
getEditable(): { stat: ExplorerItem; data: IEditableData } | undefined;
@ -105,7 +105,7 @@ export function getMultiSelectedResources(resource: URI | object | undefined, li
// Explorer
if (list instanceof AsyncDataTree && list.getFocus().every(item => item instanceof ExplorerItem)) {
// Explorer
const context = explorerService.getContext(true);
const context = explorerService.getContext(true, true);
if (context.length) {
return context.map(c => c.resource);
}