Sublime Forum

Saving file ISSUE

#1

Just installed the sublime text editor. I am trying to save a file as python, it just doesn’t DO IT. I mean I selected the python file from file type dropdown menu. But when I save it, it doesn’t save as python file. I did it multiple times… I also went to the folder location and found the file and it sure is not saved as a python file but just as a FILE. Only when I put .py after the name does it save as python file. I uninstalled and installed the sublime text editor again. Still the same issue. Just don’t know what to do. It sure shows all the available formats one can save the file… and thankfully the ‘.extensions’ as well so at least you aren’t guessing what the file extensions should be… but still it is A TEXT EDITOR, IT ATLEAST SHOULD BE ABLE TO SAVE FILE IN RESPECTIVE FORMATS. I’m sorry if it is my fault and I don’t know if I would ever solve it or just start to type the file extensions manually.

0 Likes

#2

The text editor doesn’t have any idea of what content you will be putting before hand in a file. It can be some python code, rust code or an environment file and they do different things. You can’t expect any editor (or even an IDE for that matter) to detect, what the content you have typed belongs to (the language/type of your content in your yet to be named unsaved file).
Uninstalling, reinstalling, reverting Sublime will not do anything because it just doesn’t work that way.

Only you know the logic to solve your problem and you know what language it is to be written in. The text editor doesn’t know that. So show it some love and through in that quick .py
This is in response to what you have asked in capitalized.

Regarding your question as to why the file doesn’t pick up the extension from the Save as type ... extension drop down, here is something you may find useful.

I just don’t use that drop down because it is just easier to type that .py and be done with it rather than scroll all the way down through that list & search for python extensions.

Hope that helps :slightly_smiling_face:

2 Likes

#3

Works like a charm here.

1 Like

#4

I tried that on Windows 7, but that Save as type ... doesn’t work for me. But I just save any files with their extensions rather than going down rabbit holes.

1 Like

#5

Thank you for taking the time… I find the reply very useful.
I never wanted it to detect python language from raw text alone… just in the save as file dialogue box… and that too I am willing to select the file type myself… just was bummed that even after selecting the appropriate file type(python) it didn’t save it as python file. But yeah I guess it would be quicker FOR SURE to write .py than to select the file type… it was just so unexpected and bizarre to experience this(seems so intuitive to do but fails to function like the x button failing to close or _ failing to minimize)… I realize there must be something wrong with my computer in background which might be messing it up somehow… it might be the ‘space’ in my username ‘Am Ak’ that could be causing it… at this point I don’t know what it might be…

Until I know, love it is… by typing .py… it surely saves time.

0 Likes

#6

I have to try that…
So I just type in all caps SETSYNTAXPY and the command should appear… right? Do I have to enable something or some option?
This seems very good as i don’t even have to open the save file as option

0 Likes

#7

Just to note, the case doesn’t matter and you don’t have to type exactly that text; it’s just filtering the commands in the command palette to ones that match the text; something like synpy would work as well, depending on the packages you have installed.

In addition, the command palette learns what options you pick in response to filter text; so you could enter spy and then manually pick the Set Syntax: Python command by using the arrow keys. Once you do that, the command will be offered the next time you enter spy by default because that’s the command you picked the last time you used that filter.

1 Like