File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export class PullRequestChangesTreeDataProvider extends Disposable implements vs
3838 this . _view = this . _register ( vscode . window . createTreeView ( 'prStatus:github' , {
3939 treeDataProvider : this ,
4040 showCollapseAll : true ,
41+ canSelectMany : true
4142 } ) ) ;
4243
4344 this . _register (
@@ -54,7 +55,7 @@ export class PullRequestChangesTreeDataProvider extends Disposable implements vs
5455 } ) ,
5556 ) ;
5657
57- this . _register ( this . _view . onDidChangeCheckboxState ( TreeUtils . processCheckboxUpdates ) ) ;
58+ this . _register ( this . _view . onDidChangeCheckboxState ( e => TreeUtils . processCheckboxUpdates ( e , this . _view . selection ) ) ) ;
5859 }
5960
6061 refresh ( treeNode ?: TreeNode ) {
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ export class PullRequestsTreeDataProvider extends Disposable implements vscode.T
9595 }
9696 } ) ) ;
9797
98- this . _register ( this . _view . onDidChangeCheckboxState ( TreeUtils . processCheckboxUpdates ) ) ;
98+ this . _register ( this . _view . onDidChangeCheckboxState ( e => TreeUtils . processCheckboxUpdates ( e , [ ] ) ) ) ;
9999
100100 this . _register ( this . _view . onDidExpandElement ( expanded => {
101101 this . prsTreeModel . updateExpandedQueries ( expanded . element , true ) ;
Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ import { FileChangeNode } from './fileChangeNode';
88import { TreeNode } from './treeNode' ;
99
1010export namespace TreeUtils {
11- export function processCheckboxUpdates ( checkboxUpdates : vscode . TreeCheckboxChangeEvent < TreeNode > ) {
11+ export function processCheckboxUpdates ( checkboxUpdates : vscode . TreeCheckboxChangeEvent < TreeNode > , selection : readonly TreeNode [ ] ) {
12+ const selectionContainsUpdates = selection . some ( node => checkboxUpdates . items . some ( update => update [ 0 ] === node ) ) ;
13+
1214 const checkedNodes : FileChangeNode [ ] = [ ] ;
1315 const uncheckedNodes : FileChangeNode [ ] = [ ] ;
1416
@@ -27,6 +29,21 @@ export namespace TreeUtils {
2729 node . updateFromCheckboxChanged ( newState ) ;
2830 } ) ;
2931
32+ if ( selectionContainsUpdates ) {
33+ for ( const selected of selection ) {
34+ if ( ! ( selected instanceof FileChangeNode ) ) {
35+ continue ;
36+ }
37+ if ( ! checkedNodes . includes ( selected ) && ! uncheckedNodes . includes ( selected ) ) {
38+ if ( selected . checkboxState . state === vscode . TreeItemCheckboxState . Unchecked ) {
39+ checkedNodes . push ( selected ) ;
40+ } else {
41+ uncheckedNodes . push ( selected ) ;
42+ }
43+ }
44+ }
45+ }
46+
3047 if ( checkedNodes . length > 0 ) {
3148 const prModel = checkedNodes [ 0 ] . pullRequest ;
3249 const filenames = checkedNodes . map ( n => n . fileName ) ;
You can’t perform that action at this time.
0 commit comments