@@ -659,8 +659,9 @@ export interface IOpenEvent<T> {
659659 browserEvent ?: UIEvent ;
660660}
661661
662- export interface IResourceResultsNavigationOptions {
663- openOnFocus : boolean ;
662+ export interface IResourceResultsNavigationOptions2 {
663+ openOnFocus ?: boolean ;
664+ openOnSelection ?: boolean ;
664665}
665666
666667export interface SelectionKeyboardEvent extends KeyboardEvent {
@@ -676,14 +677,24 @@ export function getSelectionKeyboardEvent(typeArg = 'keydown', preserveFocus?: b
676677
677678export class TreeResourceNavigator2 < T , TFilterData > extends Disposable {
678679
680+ private options : IResourceResultsNavigationOptions2 ;
681+
679682 private readonly _onDidOpenResource = new Emitter < IOpenEvent < T | null > > ( ) ;
680683 readonly onDidOpenResource : Event < IOpenEvent < T | null > > = this . _onDidOpenResource . event ;
681684
682685 constructor (
683686 private tree : WorkbenchObjectTree < T , TFilterData > | WorkbenchDataTree < any , T , TFilterData > | WorkbenchAsyncDataTree < any , T , TFilterData > ,
684- private options ?: IResourceResultsNavigationOptions
687+ options ?: IResourceResultsNavigationOptions2
685688 ) {
686689 super ( ) ;
690+
691+ this . options = {
692+ ...< IResourceResultsNavigationOptions2 > {
693+ openOnSelection : true
694+ } ,
695+ ...( options || { } )
696+ } ;
697+
687698 this . registerListeners ( ) ;
688699 }
689700
@@ -692,7 +703,10 @@ export class TreeResourceNavigator2<T, TFilterData> extends Disposable {
692703 this . _register ( this . tree . onDidChangeFocus ( e => this . onFocus ( e ) ) ) ;
693704 }
694705
695- this . _register ( this . tree . onDidChangeSelection ( e => this . onSelection ( e ) ) ) ;
706+ if ( this . options && this . options . openOnSelection ) {
707+ this . _register ( this . tree . onDidChangeSelection ( e => this . onSelection ( e ) ) ) ;
708+ }
709+
696710 this . _register ( this . tree . onDidOpen ( e => this . onSelection ( e ) ) ) ;
697711 }
698712
0 commit comments