@@ -89,9 +89,10 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
89
89
90
90
if ( this . filesConfigurationService . getAutoSaveMode ( ) !== AutoSaveMode . OFF ) {
91
91
92
- // Save all modified working copies
92
+ // Save all modified working copies that can be auto-saved
93
93
try {
94
- await this . doSaveAllBeforeShutdown ( false /* not untitled */ , SaveReason . AUTO ) ;
94
+ const workingCopiesToSave = modifiedWorkingCopies . filter ( wc => ! ( wc . capabilities & WorkingCopyCapabilities . Untitled ) ) ;
95
+ await this . doSaveAllBeforeShutdown ( workingCopiesToSave , SaveReason . AUTO ) ;
95
96
} catch ( error ) {
96
97
this . logService . error ( `[backup tracker] error saving modified working copies: ${ error } ` ) ; // guard against misbehaving saves, we handle remaining modified below
97
98
}
@@ -302,16 +303,8 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
302
303
return true ; // veto (user canceled)
303
304
}
304
305
305
- private doSaveAllBeforeShutdown ( modifiedWorkingCopies : IWorkingCopy [ ] , reason : SaveReason ) : Promise < void > ;
306
- private doSaveAllBeforeShutdown ( includeAllUntitled : boolean , reason : SaveReason ) : Promise < void > ;
307
- private doSaveAllBeforeShutdown ( arg1 : IWorkingCopy [ ] | boolean , reason : SaveReason ) : Promise < void > {
308
- const modifiedWorkingCopies = Array . isArray ( arg1 ) ? arg1 : this . workingCopyService . modifiedWorkingCopies . filter ( workingCopy => {
309
- if ( arg1 === false && ( workingCopy . capabilities & WorkingCopyCapabilities . Untitled ) ) {
310
- return false ; // skip untitled unless explicitly included
311
- }
312
-
313
- return true ;
314
- } ) ;
306
+ private doSaveAllBeforeShutdown ( workingCopies : IWorkingCopy [ ] , reason : SaveReason ) : Promise < void > {
307
+ const modifiedWorkingCopies = workingCopies ;
315
308
316
309
return this . withProgressAndCancellation ( async ( ) => {
317
310
@@ -320,12 +313,10 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
320
313
321
314
// First save through the editor service if we save all to benefit
322
315
// from some extras like switching to untitled modified editors before saving.
323
-
324
316
let result : boolean | undefined = undefined ;
325
- if ( typeof arg1 === 'boolean' || modifiedWorkingCopies . length === this . workingCopyService . modifiedCount ) {
317
+ if ( modifiedWorkingCopies . length === this . workingCopyService . modifiedCount ) {
326
318
result = ( await this . editorService . saveAll ( {
327
- includeScratchpad : typeof arg1 === 'boolean' ? arg1 : true ,
328
- includeUntitled : typeof arg1 === 'boolean' ? arg1 : true ,
319
+ includeUntitled : { includeScratchpad : true } ,
329
320
...saveOptions
330
321
} ) ) . success ;
331
322
}
0 commit comments