File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
src/vs/workbench/contrib/files Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -372,11 +372,17 @@ export class ExplorerService implements IExplorerService {
372
372
// Delete
373
373
else if ( e . isOperation ( FileOperation . DELETE ) ) {
374
374
const modelElements = this . model . findAll ( e . resource ) ;
375
- await Promise . all ( modelElements . map ( async element => {
376
- if ( element . parent ) {
377
- const parent = element . parent ;
375
+ await Promise . all ( modelElements . map ( async modelElement => {
376
+ if ( modelElement . parent ) {
378
377
// Remove Element from Parent (Model)
379
- parent . removeChild ( element ) ;
378
+ const parent = modelElement . parent ;
379
+ parent . removeChild ( modelElement ) ;
380
+
381
+ const oldNestedParent = modelElement . nestedParent ;
382
+ if ( oldNestedParent ) {
383
+ oldNestedParent . removeChild ( modelElement ) ;
384
+ await this . view ?. refresh ( false , oldNestedParent ) ;
385
+ }
380
386
// Refresh Parent (View)
381
387
await this . view ?. refresh ( false , parent ) ;
382
388
}
Original file line number Diff line number Diff line change @@ -301,7 +301,9 @@ export class ExplorerItem {
301
301
const nestingConfig = this . configService . getValue < IFilesConfiguration > ( { resource : this . root . resource } ) . explorer . experimental . fileNesting ;
302
302
303
303
// fast path when the children can be resolved sync
304
- if ( nestingConfig . enabled && this . nestedChildren ) { return this . nestedChildren ; }
304
+ if ( nestingConfig . enabled && this . nestedChildren ) {
305
+ return this . nestedChildren ;
306
+ }
305
307
306
308
return ( async ( ) => {
307
309
if ( ! this . _isDirectoryResolved ) {
@@ -383,11 +385,13 @@ export class ExplorerItem {
383
385
* Removes a child element from this folder.
384
386
*/
385
387
removeChild ( child : ExplorerItem ) : void {
388
+ this . nestedChildren = undefined ;
386
389
this . children . delete ( this . getPlatformAwareName ( child . name ) ) ;
387
390
}
388
391
389
392
forgetChildren ( ) : void {
390
393
this . children . clear ( ) ;
394
+ this . nestedChildren = undefined ;
391
395
this . _isDirectoryResolved = false ;
392
396
this . _fileNester = undefined ;
393
397
}
@@ -400,6 +404,9 @@ export class ExplorerItem {
400
404
* Moves this element under a new parent element.
401
405
*/
402
406
move ( newParent : ExplorerItem ) : void {
407
+ if ( this . nestedParent ) {
408
+ this . nestedParent . removeChild ( this ) ;
409
+ }
403
410
if ( this . _parent ) {
404
411
this . _parent . removeChild ( this ) ;
405
412
}
You can’t perform that action at this time.
0 commit comments