Skip to content

Commit

Permalink
Fix tree selection context and command args (#211429)
Browse files Browse the repository at this point in the history
Fixes #210046
  • Loading branch information
alexr00 committed Apr 26, 2024
1 parent e0e7aec commit e229ffd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/vs/workbench/browser/parts/views/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,10 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {

this.tree!.setFocus([node]);
let selected = this.canSelectMany ? this.getSelection() : [];
if (selected.length === 0) {
if (!selected.find(item => item.handle === node.handle)) {
selected = [node];
}

const actions = treeMenus.getResourceContextActions(selected);
if (!actions.length) {
return;
Expand Down Expand Up @@ -1567,8 +1568,8 @@ class MultipleSelectionActionRunner extends ActionRunner {
});
}

if (!actionInSelected && selectionHandleArgs && selectionHandleArgs.length > 0) {
context = selectionHandleArgs[0];
if (!actionInSelected && selectionHandleArgs) {
selectionHandleArgs = undefined;
}

await action.run(context, selectionHandleArgs);
Expand Down

0 comments on commit e229ffd

Please sign in to comment.