@@ -30,7 +30,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
3030import { createTextBufferFactoryFromSnapshot , createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel' ;
3131import { IModelService } from 'vs/editor/common/services/modelService' ;
3232import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
33- import { isEqualOrParent , isEqual , joinPath , dirname , extname , basename } from 'vs/base/common/resources' ;
33+ import { isEqualOrParent , isEqual , joinPath , dirname , extname , basename , toLocalResource } from 'vs/base/common/resources' ;
3434import { posix } from 'vs/base/common/path' ;
3535import { getConfirmMessage , IDialogService , IFileDialogService , ISaveDialogOptions , IConfirmation } from 'vs/platform/dialogs/common/dialogs' ;
3636import { IModeService } from 'vs/editor/common/services/modeService' ;
@@ -570,7 +570,7 @@ export class TextFileService extends Disposable implements ITextFileService {
570570
571571 // Untitled with associated file path don't need to prompt
572572 if ( this . untitledEditorService . hasAssociatedFilePath ( untitled ) ) {
573- targetUri = this . untitledToAssociatedFileResource ( untitled ) ;
573+ targetUri = toLocalResource ( untitled , this . environmentService . configuration . remoteAuthority ) ;
574574 }
575575
576576 // Otherwise ask user
@@ -607,18 +607,6 @@ export class TextFileService extends Disposable implements ITextFileService {
607607 } ) ;
608608 }
609609
610- private untitledToAssociatedFileResource ( untitled : URI ) : URI {
611- const authority = this . environmentService . configuration . remoteAuthority ;
612- if ( authority ) {
613- let path = untitled . path ;
614- if ( path && path [ 0 ] !== posix . sep ) {
615- path = posix . sep + path ;
616- }
617- return untitled . with ( { scheme : Schemas . vscodeRemote , authority, path } ) ;
618- }
619- return untitled . with ( { scheme : Schemas . file } ) ;
620- }
621-
622610 private doSaveAllFiles ( resources ?: URI [ ] , options : ISaveOptions = Object . create ( null ) ) : Promise < ITextFileOperationResult > {
623611 const dirtyFileModels = this . getDirtyFileModels ( Array . isArray ( resources ) ? resources : undefined /* Save All */ )
624612 . filter ( model => {
@@ -762,7 +750,7 @@ export class TextFileService extends Disposable implements ITextFileService {
762750 // path. This can happen if the file was created after the untitled file was opened.
763751 // See https://github.com/Microsoft/vscode/issues/67946
764752 let confirmWrite : Promise < boolean > ;
765- if ( sourceModel instanceof UntitledEditorModel && sourceModel . hasAssociatedFilePath && targetExists && isEqual ( target , this . untitledToAssociatedFileResource ( sourceModel . getResource ( ) ) ) ) {
753+ if ( sourceModel instanceof UntitledEditorModel && sourceModel . hasAssociatedFilePath && targetExists && isEqual ( target , toLocalResource ( sourceModel . getResource ( ) , this . environmentService . configuration . remoteAuthority ) ) ) {
766754 confirmWrite = this . confirmOverwrite ( target ) ;
767755 } else {
768756 confirmWrite = Promise . resolve ( true ) ;
0 commit comments