@@ -15,7 +15,7 @@ import { IFileService, FileOperationEvent, FileOperation, FileChangesEvent, File
1515import { Schemas } from 'vs/base/common/network' ;
1616import { Event , Emitter } from 'vs/base/common/event' ;
1717import { URI } from 'vs/base/common/uri' ;
18- import { basename , joinPath } from 'vs/base/common/resources' ;
18+ import { basename , joinPath , extUri } from 'vs/base/common/resources' ;
1919import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput' ;
2020import { IEditorGroupsService , IEditorGroup , GroupsOrder , IEditorReplacement , GroupChangeKind , preferredSideBySideGroupDirection , OpenEditorContext } from 'vs/workbench/services/editor/common/editorGroupsService' ;
2121import { IResourceEditorInputType , SIDE_GROUP , IResourceEditorReplacement , IOpenEditorOverrideHandler , IEditorService , SIDE_GROUP_TYPE , ACTIVE_GROUP_TYPE , ISaveEditorsOptions , ISaveAllEditorsOptions , IRevertAllEditorsOptions , IBaseSaveRevertAllEditorOptions , IOpenEditorOverrideEntry , ICustomEditorViewTypesHandler , ICustomEditorInfo } from 'vs/workbench/services/editor/common/editorService' ;
@@ -938,19 +938,13 @@ export class EditorService extends Disposable implements EditorServiceImpl {
938938 }
939939
940940 private asCanonicalEditorResource ( resource : URI ) : URI {
941- // We prefer to use the canonical form unless we know that a model
942- // for the given URI already exists.
943- // If no model exists, we do not trust the resource that is being
944- // passed in as being the truth (e.g. in terms of path casing) and
945- // as such we ask the URI service to give us the canconical form of
946- // the URI. As such we ensure that any editor that is being opened
947- // will use the same canonical form of the URI.
948- let canonicalResource : URI ;
949- if ( this . modelService ?. getModel ( resource ) ) {
950- // TODO@Ben remove this check once canonical URIs are adopted in ITextModelResolerService
951- canonicalResource = resource ;
952- } else {
953- canonicalResource = this . uriIdentityService . asCanonicalUri ( resource ) ;
941+ const canonicalResource : URI = this . uriIdentityService . asCanonicalUri ( resource ) ;
942+
943+ // In the unlikely case that a model exists for the original resource but
944+ // differs from the canonical resource, we print a warning as this means
945+ // the model will not be able to be opened as editor.
946+ if ( ! extUri . isEqual ( resource , canonicalResource ) && this . modelService ?. getModel ( resource ) ) {
947+ console . warn ( `EditorService: a model exists for a resource that is not canonical: ${ resource . toString ( true ) } ` ) ;
954948 }
955949
956950 return canonicalResource ;
0 commit comments