@@ -191,6 +191,7 @@ export class FileTreeRenderer extends DirListing.Renderer {
191
191
/**
192
192
* A widget which hosts a filetree.
193
193
*/
194
+ // @ts -ignore: _onPathChanged is private upstream, need to change this
194
195
export class DirTreeListing extends DirListing {
195
196
constructor ( options : DirTreeListing . IOptions ) {
196
197
super ( { ...options , renderer : new FileTreeRenderer ( options . model ) } ) ;
@@ -229,6 +230,10 @@ export class DirTreeListing extends DirListing {
229
230
}
230
231
}
231
232
233
+ _onPathChanged ( ) : void {
234
+ // It's a no-op to overwrite the base class behavior
235
+ }
236
+
232
237
private _eventDragEnter ( event : IDragEvent ) : void {
233
238
if ( event . mimeData . hasData ( CONTENTS_MIME ) ) {
234
239
// @ts -ignore
@@ -428,19 +433,26 @@ export class FilterFileTreeBrowserModel extends FilterFileBrowserModel {
428
433
}
429
434
430
435
set path ( value : string ) {
431
- this . _path = value ;
436
+ let needsToEmit = false ;
432
437
433
- if ( this . _path = == value ) {
434
- return ;
438
+ if ( this . _path ! == value ) {
439
+ needsToEmit = true ;
435
440
}
436
441
437
- const pathChanged = this . pathChanged as Signal < this , IChangedArgs < string > > ;
442
+ this . _path = value ;
438
443
439
- pathChanged . emit ( {
440
- name : 'path' ,
441
- oldValue : this . _path ,
442
- newValue : value
443
- } ) ;
444
+ if ( needsToEmit ) {
445
+ const pathChanged = this . pathChanged as Signal <
446
+ this,
447
+ IChangedArgs < string >
448
+ > ;
449
+
450
+ pathChanged . emit ( {
451
+ name : 'path' ,
452
+ oldValue : this . _path ,
453
+ newValue : PathExt . dirname ( this . _path )
454
+ } ) ;
455
+ }
444
456
}
445
457
446
458
/**
@@ -668,6 +680,7 @@ export class FileTreeBrowser extends FileBrowser {
668
680
}
669
681
670
682
protected createDirListing ( options : DirListing . IOptions ) : DirListing {
683
+ // @ts -ignore: _onPathChanged is private upstream, need to change this
671
684
return new DirTreeListing ( {
672
685
model : this . model ,
673
686
translator : this . translator
@@ -680,5 +693,6 @@ export class FileTreeBrowser extends FileBrowser {
680
693
681
694
model : FilterFileTreeBrowserModel ;
682
695
696
+ // @ts -ignore: _onPathChanged is private upstream, need to change this
683
697
listing : DirTreeListing ;
684
698
}
0 commit comments