@@ -106,26 +106,6 @@ export class MainThreadCustomEditors extends Disposable implements extHostProtoc
106
106
107
107
// Working copy operations
108
108
this . _register ( workingCopyFileService . onWillRunWorkingCopyFileOperation ( async e => this . onWillRunWorkingCopyFileOperation ( e ) ) ) ;
109
-
110
- this . _register ( extensionService . onWillStop ( e => {
111
- const dirtyCustomEditors = workingCopyService . workingCopies . filter ( workingCopy => {
112
- return workingCopy instanceof MainThreadCustomEditorModel && workingCopy . isDirty ( ) ;
113
- } ) ;
114
- if ( ! dirtyCustomEditors . length ) {
115
- return ;
116
- }
117
-
118
- e . veto ( ( async ( ) => {
119
- for ( const dirtyCustomEditor of dirtyCustomEditors ) {
120
- const didSave = await dirtyCustomEditor . save ( ) ;
121
- if ( ! didSave ) {
122
- // Veto
123
- return true ;
124
- }
125
- }
126
- return false ; // Don't veto
127
- } ) ( ) , localize ( 'vetoExtHostRestart' , "One or more custom editors could not be saved." ) ) ;
128
- } ) ) ;
129
109
}
130
110
131
111
public $registerTextEditorProvider ( extensionData : extHostProtocol . WebviewExtensionDescription , viewType : string , options : extHostProtocol . IWebviewPanelOptions , capabilities : extHostProtocol . CustomTextEditorCapabilities , serializeBuffersForPostMessage : boolean ) : void {
@@ -399,13 +379,29 @@ class MainThreadCustomEditorModel extends ResourceWorkingCopy implements ICustom
399
379
@IWorkbenchEnvironmentService private readonly _environmentService : IWorkbenchEnvironmentService ,
400
380
@IWorkingCopyService workingCopyService : IWorkingCopyService ,
401
381
@IPathService private readonly _pathService : IPathService ,
382
+ @IExtensionService extensionService : IExtensionService ,
402
383
) {
403
384
super ( MainThreadCustomEditorModel . toWorkingCopyResource ( _viewType , _editorResource ) , fileService ) ;
404
385
405
386
this . _fromBackup = fromBackup ;
406
387
407
388
if ( _editable ) {
408
389
this . _register ( workingCopyService . registerWorkingCopy ( this ) ) ;
390
+
391
+ this . _register ( extensionService . onWillStop ( e => {
392
+ if ( ! this . isDirty ( ) ) {
393
+ return ;
394
+ }
395
+
396
+ e . veto ( ( async ( ) => {
397
+ const didSave = await this . save ( ) ;
398
+ if ( ! didSave ) {
399
+ // Veto
400
+ return true ;
401
+ }
402
+ return false ; // Don't veto
403
+ } ) ( ) , localize ( 'vetoExtHostRestart' , "Custom editor '{0}' could not be saved." , this . name ) ) ;
404
+ } ) ) ;
409
405
}
410
406
411
407
// Normally means we're re-opening an untitled file
0 commit comments