@@ -30,6 +30,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3030import { IModelService } from 'vs/editor/common/services/modelService' ;
3131import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
3232import { getConfirmMessage , IDialogService } from 'vs/platform/dialogs/common/dialogs' ;
33+ import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
3334
3435export class TextFileService extends AbstractTextFileService {
3536
@@ -49,7 +50,8 @@ export class TextFileService extends AbstractTextFileService {
4950 @IWindowsService windowsService : IWindowsService ,
5051 @IHistoryService historyService : IHistoryService ,
5152 @IContextKeyService contextKeyService : IContextKeyService ,
52- @IDialogService private dialogService : IDialogService
53+ @IDialogService private dialogService : IDialogService ,
54+ @IEditorService private editorService : IEditorService
5355 ) {
5456 super ( lifecycleService , contextService , configurationService , fileService , untitledEditorService , instantiationService , notificationService , environmentService , backupFileService , windowsService , historyService , contextKeyService , modelService ) ;
5557 }
@@ -102,8 +104,12 @@ export class TextFileService extends AbstractTextFileService {
102104 } ) ;
103105 }
104106
105- promptForPath ( defaultPath : string ) : TPromise < string > {
106- return this . windowService . showSaveDialog ( this . getSaveDialogOptions ( defaultPath ) ) ;
107+ promptForPath ( resource : URI , defaultPath : string ) : TPromise < string > {
108+
109+ // Help user to find a name for the file by opening it first
110+ return this . editorService . openEditor ( { resource, options : { revealIfOpened : true , preserveFocus : true , } } ) . then ( ( ) => {
111+ return this . windowService . showSaveDialog ( this . getSaveDialogOptions ( defaultPath ) ) ;
112+ } ) ;
107113 }
108114
109115 private getSaveDialogOptions ( defaultPath : string ) : Electron . SaveDialogOptions {
0 commit comments