@@ -13,7 +13,7 @@ import { URI } from 'vs/base/common/uri';
1313import { Action } from 'vs/base/common/actions' ;
1414import { Language } from 'vs/base/common/platform' ;
1515import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput' ;
16- import { IFileEditorInput , EncodingMode , IEncodingSupport , toResource , SideBySideEditorInput , IEditorPane , IEditorInput , SideBySideEditor , IModeSupport } from 'vs/workbench/common/editor' ;
16+ import { IFileEditorInput , EncodingMode , IEncodingSupport , EditorResourceAccessor , SideBySideEditorInput , IEditorPane , IEditorInput , SideBySideEditor , IModeSupport } from 'vs/workbench/common/editor' ;
1717import { Disposable , MutableDisposable , DisposableStore } from 'vs/base/common/lifecycle' ;
1818import { IEditorAction } from 'vs/editor/common/editorCommon' ;
1919import { EndOfLineSequence } from 'vs/editor/common/model' ;
@@ -867,7 +867,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
867867 private onResourceEncodingChange ( resource : URI ) : void {
868868 const activeEditorPane = this . editorService . activeEditorPane ;
869869 if ( activeEditorPane ) {
870- const activeResource = toResource ( activeEditorPane . input , { supportSideBySide : SideBySideEditor . PRIMARY } ) ;
870+ const activeResource = EditorResourceAccessor . getCanonicalUri ( activeEditorPane . input , { supportSideBySide : SideBySideEditor . PRIMARY } ) ;
871871 if ( activeResource && isEqual ( activeResource , resource ) ) {
872872 const activeCodeEditor = withNullAsUndefined ( getCodeEditor ( activeEditorPane . getControl ( ) ) ) ;
873873
@@ -1059,7 +1059,7 @@ export class ChangeModeAction extends Action {
10591059 }
10601060
10611061 const textModel = activeTextEditorControl . getModel ( ) ;
1062- const resource = this . editorService . activeEditor ? toResource ( this . editorService . activeEditor , { supportSideBySide : SideBySideEditor . PRIMARY , usePreferredResource : true } ) : null ;
1062+ const resource = EditorResourceAccessor . getOriginalUri ( this . editorService . activeEditor , { supportSideBySide : SideBySideEditor . PRIMARY } ) ;
10631063
10641064 let hasLanguageSupport = ! ! resource ;
10651065 if ( resource ?. scheme === Schemas . untitled && ! this . textFileService . untitled . get ( resource ) ?. hasAssociatedFilePath ) {
@@ -1157,7 +1157,7 @@ export class ChangeModeAction extends Action {
11571157 let languageSelection : ILanguageSelection | undefined ;
11581158 if ( pick === autoDetectMode ) {
11591159 if ( textModel ) {
1160- const resource = toResource ( activeEditor , { supportSideBySide : SideBySideEditor . PRIMARY , usePreferredResource : true } ) ;
1160+ const resource = EditorResourceAccessor . getOriginalUri ( activeEditor , { supportSideBySide : SideBySideEditor . PRIMARY } ) ;
11611161 if ( resource ) {
11621162 languageSelection = this . modeService . createByFilepathOrFirstLine ( resource , textModel . getLineContent ( 1 ) ) ;
11631163 }
@@ -1336,7 +1336,7 @@ export class ChangeEncodingAction extends Action {
13361336
13371337 await timeout ( 50 ) ; // quick input is sensitive to being opened so soon after another
13381338
1339- const resource = toResource ( activeEditorPane . input , { supportSideBySide : SideBySideEditor . PRIMARY , usePreferredResource : true } ) ;
1339+ const resource = EditorResourceAccessor . getOriginalUri ( activeEditorPane . input , { supportSideBySide : SideBySideEditor . PRIMARY } ) ;
13401340 if ( ! resource || ( ! this . fileService . canHandleResource ( resource ) && resource . scheme !== Schemas . untitled ) ) {
13411341 return ; // encoding detection only possible for resources the file service can handle or that are untitled
13421342 }
0 commit comments