From b6967cc5d83fc3c99bb2ce2f34ba8ea53af0c3e3 Mon Sep 17 00:00:00 2001 From: Theia Translation Bot <> Date: Fri, 15 Jul 2022 17:56:14 +0200 Subject: [PATCH] Provide all selected URIs for command execution --- .../browser/menus/plugin-menu-command-adapter.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts b/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts index b2536cd1264be..d4bd66039637c 100644 --- a/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts +++ b/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts @@ -245,13 +245,19 @@ export class PluginMenuCommandAdapter implements MenuCommandAdapter { return treeArgs; } - protected getSelectedResource(): [CodeUri | TreeViewSelection | undefined] { + protected getSelectedResource(): (CodeUri | CodeUri[] | TreeViewSelection | undefined)[] { const selection = this.selectionService.selection; + const resourceParams = []; if (TreeWidgetSelection.is(selection) && selection.source instanceof TreeViewWidget && selection[0]) { - return [selection.source.toTreeViewSelection(selection[0])]; + resourceParams[0] = selection.source.toTreeViewSelection(selection[0]); + } else { + const uri = this.resourceContextKey.get(); + resourceParams[0] = uri ? uri['codeUri'] : undefined; + } + if (TreeWidgetSelection.is(selection)) { + resourceParams[1] = UriSelection.getUris(selection).map(e => e['codeUri']); } - const uri = UriSelection.getUri(selection) ?? this.resourceContextKey.get(); - return [uri ? uri['codeUri'] : undefined]; + return resourceParams; } /* eslint-enable @typescript-eslint/no-explicit-any */ }