Sublime Forum

Can't save files as .js extension!

#1

hello !

so i bought the license to finally get my files saved again , it worked at the beginning just fine ,took a break until today tried to do some coding exercises , and couldn t save files under html or js extensions!

html extension finally nailed it somehow , but with the js not a chance. i followed the usual steps , save as —search in the list for the javascriptextension , save , and i get a file with no extension, .( but it still gets opened by sublime oddly enough)!

sorry forgot to upload

0 Likes

#2

This is because your OS is hiding the extension when browsing files. There is an option for turning it off, try googling it.

0 Likes

#3

tried it , no succes.
also in sublime , the file appears with no .js extension
i opened another file saved succesfully a while ago.
tried installing the program again also

0 Likes

#4

Then you’re not typing in the .js extension when you save.

0 Likes

#5

The “save as type” option doesn’t set the extension of the file, it only filters the files shown. You need to add .js yourself.

0 Likes

#6

why do I have to this now?! a couple of weeks before I didn’t need to add js extension by myself, it worked everything perfectly! I payed 80 dollars and it actually works worse?! I, m not having it!

0 Likes

#7

If this behaviour has changed for you, that is not from a change we introduced. There hasn’t been a Sublime Text update in a couple of months, so I don’t see how anything on our end could have changed in the last couple of weeks.
Sublime Text simply uses the system’s default open file dialog. Microsoft may have broken/changed this in a windows update. I’m sorry this broke your workflow and I’ll be looking into adding a workaround for future versions, but I suggest getting used to typing the extensions as it’s generally faster than finding the right entry in the dropdown list.

2 Likes

#8

then why it looks like this , when i manually change the extension??
it’s weirdly pink highlighted and i can’t take it off. on the other hand the file next to it , that wasn’t changed manually and is extensionless looks normal.

0 Likes

#9

Well, that’s because variable names in JavaScript can’t begin with a number. 1student, 2student, etc aren’t valid JavaScript variable names. So the syntax highlighter is warning you by highlighting it as pink.
The second file is just a plain text file. You haven’t saved it as a .js file.

References :-

  1. https://www.tutorialspoint.com/What-characters-are-valid-for-JavaScript-variable-names
1 Like

#10

thank you!!!

0 Likes