mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
Some explorer commands should ignore nested children (#159563)
Add ability to ingore nested children
This commit is contained in:
parent
93327316c0
commit
0ccec43747
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue