It might be specific to only some versions of MacOS perhaps? I just ran a quick test across my Windows 7 machine, my Linux Slackware machine and my MacBook running 10.10.5, all running build 3157.
In the test I had a window split into two groups, with an unsaved plain text file on the left and an unsaved JavaScript file on the right. I ran two tests; what happens if you enter the filename test
, and what happens if you enter the filename test.ext
.
I ended up with this table (please excuse the crudity of the model; I didn’t have time to build it to scale or to paint it ;)):
No Extension | Add Extension
--------------------------------------------------------------
| Windows Plain | test is test | test.ext is test.ext |
| Windows JS | test is test | test.ext is test.ext |
| Linux Plain | test is test | test.ext is test.ext |
| Linux JS | test is test | test.ext is test.ext |
| MacOS Plain | test is test | test.ext is test.ext |
| MacOS JS | test is test.js | test.ext is test.ext.js |
--------------------------------------------------------------
The first thing to note is that my Linux machine and the MacBook both offered a default filename with an appropriate extension on it (either untitiled
or untitled.js
, depending) while Windows just opened the dialog with an empty filename field. In both cases the filename was pre-selected to allow you to just enter in a filename and hit enter.
Across Windows and Linux both, whatever filename was ultimately in the filename field was the one that was used, so in the case of Linux if I override its default choice of a .js
extension, it went with what I gave it.
Conversely, on MacOS, the plain text file with no pre-entered extension saved as whatever filename I gave it, but the JavaScript file always had a .js
extension forced onto the end, even if I manually erased it and put something else in its place (including nothing at all).
The fact that the behaviour is different across the different OS’s makes me think that Sublime is just deferring to whatever the common dialog of the platform would do, or that if it has the ability to control it that it’s specifically working the way that it is to match some platform specification, the way that it moves the Preferences
and About
menu items on MacOS to be under the Sublime Text
menu entry, for example.
It should be noted that at least in my case neither the Linux file save dialog box (using XFCE as my WM) nor the MacOS save box has any field for file type, which is probably why it pre-populates a filename with extension into the file box by default for you.
I wouldn’t be completely shocked if (some versions of) MacOS do this on purpose to ensure that you don’t accidentally save a file with an extension other than the one that the application you’re using knows how to open, though.