File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
services/workingCopy/common Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,11 @@ export class EditorAutoSave extends Disposable implements IWorkbenchContribution
92
92
93
93
private maybeTriggerAutoSave ( reason : SaveReason , editorIdentifier ?: IEditorIdentifier ) : void {
94
94
if ( editorIdentifier ) {
95
- if ( editorIdentifier . editor . isReadonly ( ) || editorIdentifier . editor . hasCapability ( EditorInputCapabilities . Untitled ) ) {
95
+ if (
96
+ ! editorIdentifier . editor . isDirty ( ) ||
97
+ editorIdentifier . editor . isReadonly ( ) ||
98
+ editorIdentifier . editor . hasCapability ( EditorInputCapabilities . Untitled )
99
+ ) {
96
100
return ; // no auto save for readonly or untitled editors
97
101
}
98
102
@@ -170,15 +174,15 @@ export class EditorAutoSave extends Disposable implements IWorkbenchContribution
170
174
}
171
175
172
176
private scheduleAutoSave ( workingCopy : IWorkingCopy ) : void {
177
+ if ( workingCopy . capabilities & WorkingCopyCapabilities . Untitled ) {
178
+ return ; // we never auto save untitled working copies
179
+ }
180
+
173
181
const autoSaveAfterDelay = this . filesConfigurationService . getAutoSaveConfiguration ( workingCopy . resource ) . autoSaveDelay ;
174
182
if ( typeof autoSaveAfterDelay !== 'number' ) {
175
183
return ; // auto save after delay must be enabled
176
184
}
177
185
178
- if ( workingCopy . capabilities & WorkingCopyCapabilities . Untitled ) {
179
- return ; // we never auto save untitled working copies
180
- }
181
-
182
186
// Clear any running auto save operation
183
187
this . discardAutoSave ( workingCopy ) ;
184
188
Original file line number Diff line number Diff line change @@ -229,9 +229,11 @@ export abstract class WorkingCopyBackupTracker extends Disposable {
229
229
return workingCopy . backupDelay ; // respect working copy override
230
230
}
231
231
232
- let autoSaveMode = this . filesConfigurationService . getAutoSaveMode ( workingCopy . resource ) ;
232
+ let autoSaveMode : AutoSaveMode ;
233
233
if ( workingCopy . capabilities & WorkingCopyCapabilities . Untitled ) {
234
234
autoSaveMode = AutoSaveMode . OFF ; // auto-save is never on for untitled working copies
235
+ } else {
236
+ autoSaveMode = this . filesConfigurationService . getAutoSaveMode ( workingCopy . resource ) ;
235
237
}
236
238
237
239
return WorkingCopyBackupTracker . DEFAULT_BACKUP_SCHEDULE_DELAYS [ autoSaveMode ] ;
You can’t perform that action at this time.
0 commit comments