sindresorhus / editorconfig-sublime

Sublime Text plugin for EditorConfig - Helps developers maintain consistent coding styles between different editors
MIT License
1.77k stars 108 forks source link

What's the reason for not showing encoding in the status line right from the start? #86

Open ams-tschoening opened 4 years ago

ams-tschoening commented 4 years ago

Looking for another way to deal with #85, I configured the default_encoding for Perl files to be Western (Windows 1252). Intention was that if an .editorconfig defining utf-8 is available, that will simply override the Perl-specific default of Sublime and otherwise using windows-1252 is the right thing to do.

This seems to work as intended, but initially loading a Perl file containing ASCII only with having utf-8 configured in .editorconfig shows Western (Windows 1252) as the current encoding. Only after saving the file this gets changed to UTF-8:

Clipboard01 Clipboard02 Clipboard03

The reason most likely is that view.set_encoding(...) is only called in apply_pre_save instead of in apply_config, like is done for some other settings.

But why is that? If you want to be sure to not show a wrong encoding, that's exactly what happens now. :-) Would you like to change this to show the encoding right from the start? The same seems to apply to line endings.