Skip to content

Commit

Permalink
Provide all selected URIs for command execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Theia Translation Bot committed Jul 15, 2022
1 parent a70c66a commit b6967cc
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

0 comments on commit b6967cc

Please sign in to comment.