File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed
contrib/interactive/browser
workingCopy/electron-sandbox Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,13 @@ export abstract class EditorInput extends AbstractEditorInput {
185
185
return false ;
186
186
}
187
187
188
+ /**
189
+ * Returns if the input has unsaved changes.
190
+ */
191
+ isModified ( ) : boolean {
192
+ return this . isDirty ( ) ;
193
+ }
194
+
188
195
/**
189
196
* Returns if this input is currently being saved or soon to be
190
197
* saved. Based on this assumption the editor may for example
Original file line number Diff line number Diff line change @@ -219,6 +219,10 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
219
219
return basename . substr ( 0 , basename . length - paths . extname ( p ) . length ) ;
220
220
}
221
221
222
+ override isModified ( ) {
223
+ return true ;
224
+ }
225
+
222
226
override dispose ( ) {
223
227
// we support closing the interactive window without prompt, so the editor model should not be dirty
224
228
this . _editorModelReference ?. revert ( { soft : true } ) ;
Original file line number Diff line number Diff line change @@ -980,7 +980,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
980
980
}
981
981
982
982
saveAll ( options ?: ISaveAllEditorsOptions ) : Promise < ISaveEditorsResult > {
983
- return this . save ( this . getAllDirtyEditors ( options ) , options ) ;
983
+ return this . save ( this . getAllModifiedEditors ( options ) , options ) ;
984
984
}
985
985
986
986
async revert ( editors : IEditorIdentifier | IEditorIdentifier [ ] , options ?: IRevertOptions ) : Promise < boolean > {
@@ -1006,15 +1006,19 @@ export class EditorService extends Disposable implements EditorServiceImpl {
1006
1006
}
1007
1007
1008
1008
async revertAll ( options ?: IRevertAllEditorsOptions ) : Promise < boolean > {
1009
- return this . revert ( this . getAllDirtyEditors ( options ) , options ) ;
1009
+ return this . revert ( this . getAllModifiedEditors ( options ) , options ) ;
1010
1010
}
1011
1011
1012
- private getAllDirtyEditors ( options ?: IBaseSaveRevertAllEditorOptions ) : IEditorIdentifier [ ] {
1012
+ private getAllModifiedEditors ( options ?: IBaseSaveRevertAllEditorOptions ) : IEditorIdentifier [ ] {
1013
1013
const editors : IEditorIdentifier [ ] = [ ] ;
1014
1014
1015
1015
for ( const group of this . editorGroupService . getGroups ( GroupsOrder . MOST_RECENTLY_ACTIVE ) ) {
1016
1016
for ( const editor of group . getEditors ( EditorsOrder . MOST_RECENTLY_ACTIVE ) ) {
1017
- if ( ! editor . isDirty ( ) ) {
1017
+ if ( ! editor . isModified ( ) ) {
1018
+ continue ;
1019
+ }
1020
+
1021
+ if ( ! options ?. includeScratchpad && editor . hasCapability ( EditorInputCapabilities . Scratchpad ) ) {
1018
1022
continue ;
1019
1023
}
1020
1024
Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ export interface IBaseSaveRevertAllEditorOptions {
82
82
*/
83
83
readonly includeUntitled ?: boolean ;
84
84
85
+ /**
86
+ * Whether to include scratchpad editors.
87
+ * if set to true, `includeUntitled` should also be true.
88
+ */
89
+ readonly includeScratchpad ?: boolean ;
90
+
85
91
/**
86
92
* Whether to exclude sticky editors.
87
93
*/
Original file line number Diff line number Diff line change @@ -323,7 +323,11 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
323
323
324
324
let result : boolean | undefined = undefined ;
325
325
if ( typeof arg1 === 'boolean' || modifiedWorkingCopies . length === this . workingCopyService . modifiedCount ) {
326
- result = ( await this . editorService . saveAll ( { includeUntitled : typeof arg1 === 'boolean' ? arg1 : true , ...saveOptions } ) ) . success ;
326
+ result = ( await this . editorService . saveAll ( {
327
+ includeScratchpad : true ,
328
+ includeUntitled : typeof arg1 === 'boolean' ? arg1 : true ,
329
+ ...saveOptions
330
+ } ) ) . success ;
327
331
}
328
332
329
333
// If we still have modified working copies, save those directly
You can’t perform that action at this time.
0 commit comments