@@ -31,8 +31,6 @@ import { extUri } from 'vs/base/common/resources';
31
31
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility' ;
32
32
import { PLAINTEXT_LANGUAGE_ID } from 'vs/editor/common/languages/modesRegistry' ;
33
33
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
34
- import { IModelLanguageChangedEvent } from 'vs/editor/common/textModelEvents' ;
35
- import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
36
34
37
35
interface IBackupMetaData extends IWorkingCopyBackupMeta {
38
36
mtime : number ;
@@ -121,8 +119,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
121
119
@ILanguageDetectionService languageDetectionService : ILanguageDetectionService ,
122
120
@IAccessibilityService accessibilityService : IAccessibilityService ,
123
121
@IPathService private readonly pathService : IPathService ,
124
- @IExtensionService private readonly extensionService : IExtensionService ,
125
- @IConfigurationService private readonly configurationService : IConfigurationService
122
+ @IExtensionService private readonly extensionService : IExtensionService
126
123
) {
127
124
super ( modelService , languageService , languageDetectionService , accessibilityService ) ;
128
125
@@ -567,7 +564,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
567
564
568
565
// Listen to text model events
569
566
this . _register ( model . onDidChangeContent ( e => this . onModelContentChanged ( model , e . isUndoing || e . isRedoing ) ) ) ;
570
- this . _register ( model . onDidChangeLanguage ( e => this . onMaybeDidChangeEncoding ( e ) ) ) ; // detect possible encoding change via language specific settings
567
+ this . _register ( model . onDidChangeLanguage ( e => this . onMaybeDidChangeEncoding ( ) ) ) ; // detect possible encoding change via language specific settings
571
568
}
572
569
573
570
private onModelContentChanged ( model : ITextModel , isUndoingOrRedoing : boolean ) : void {
@@ -1003,7 +1000,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
1003
1000
1004
1001
//#region Encoding
1005
1002
1006
- private async onMaybeDidChangeEncoding ( e : IModelLanguageChangedEvent ) : Promise < void > {
1003
+ private async onMaybeDidChangeEncoding ( ) : Promise < void > {
1007
1004
1008
1005
// This is a bit of a hack but there is a narrow case where
1009
1006
// per-language configured encodings are not working:
@@ -1017,14 +1014,10 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
1017
1014
// To mitigate this issue, when we detect the model language
1018
1015
// changes, we see if there is a specific encoding configured
1019
1016
// for the new language and apply it, only if the model is
1020
- // not dirty and has finished resolving .
1017
+ // not dirty.
1021
1018
//
1022
1019
// (see https://github.com/microsoft/vscode/issues/127936)
1023
1020
1024
- if ( ! this . configurationService . inspect ( 'files.encoding' ) . overrideIdentifiers ?. includes ( e . newLanguage ) ) {
1025
- return ; // only when there is a language specific override for the new language
1026
- }
1027
-
1028
1021
const { encoding } = await this . textFileService . encoding . getPreferredReadEncoding ( this . resource ) ;
1029
1022
if ( typeof encoding !== 'string' || ! this . isNewEncoding ( encoding ) ) {
1030
1023
return ; // return early if encoding is invalid or did not change
0 commit comments