-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide all selected URIs for command execution #11424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that the changes work as expected with the provided test extension 👍
b6967cc
to
82050e7
Compare
@colin-grant-work Thanks for the hint, I was able to rebase easily 👍 |
@@ -245,13 +245,19 @@ export class PluginMenuCommandAdapter implements MenuCommandAdapter { | |||
return treeArgs; | |||
} | |||
|
|||
protected getSelectedResource(): [CodeUri | TreeViewSelection | undefined] { | |||
protected getSelectedResource(): (CodeUri | CodeUri[] | TreeViewSelection | undefined)[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest this more exact typing?
protected getSelectedResources(): [CodeUri | TreeViewSelection | undefined, CodeUri[] | undefined] {
const selection = this.selectionService.selection;
const firstMember = TreeWidgetSelection.is(selection) && selection.source instanceof TreeViewWidget && selection[0]
? selection.source.toTreeViewSelection(selection[0])
: (UriSelection.getUri(selection) ?? this.resourceContextKey.get())?.['codeUri'];
const secondMember = TreeWidgetSelection.is(selection)
? UriSelection.getUris(selection).map(uri => uri['codeUri'])
: undefined;
return [firstMember, secondMember];
}
82050e7
to
1764529
Compare
What it does
Closes #10198
VSCode provides in addition to the URI of the last selected file in the explorer also an array of all selected URIs. This change aligns Theia to this behavior.
How to test
Show URIs
command in the context menu of the file explorerReview checklist
Reminder for reviewers