Fix tree selection context and command args (#211429)

Fixes #210046
This commit is contained in:
Alex Ross 2024-04-26 10:58:24 +02:00 committed by GitHub
parent e0e7aeca17
commit e229ffdb0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -801,9 +801,10 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {
this.tree!.setFocus([node]); this.tree!.setFocus([node]);
let selected = this.canSelectMany ? this.getSelection() : []; let selected = this.canSelectMany ? this.getSelection() : [];
if (selected.length === 0) { if (!selected.find(item => item.handle === node.handle)) {
selected = [node]; selected = [node];
} }
const actions = treeMenus.getResourceContextActions(selected); const actions = treeMenus.getResourceContextActions(selected);
if (!actions.length) { if (!actions.length) {
return; return;
@ -1567,8 +1568,8 @@ class MultipleSelectionActionRunner extends ActionRunner {
}); });
} }
if (!actionInSelected && selectionHandleArgs && selectionHandleArgs.length > 0) { if (!actionInSelected && selectionHandleArgs) {
context = selectionHandleArgs[0]; selectionHandleArgs = undefined;
} }
await action.run(context, selectionHandleArgs); await action.run(context, selectionHandleArgs);