Repository: spyder-ide/spyder

Issue:
Default file extension should be .py instead of empty
## The default file type is empty in the save dialogs

**What steps will reproduce the problem?**
1. Open any document and use save as dialog
2. if there exists any remove the extension
3. Click save

**What is the expected output? What do you see instead?**

The expected outcome (I think) the file should be save with a defauly .py extension instead of no-extension state. 

**Please provide any additional information below**

You can see from the screenshot possible extension recommendation windows is also empty

![zzzz](https://cloud.githubusercontent.com/assets/1303842/18669359/ef8a8c5c-7f3a-11e6-916c-67c92516d09d.PNG)
## Versions and main components
- Spyder Version: 3.0.0b7
- Python Version: 3.6
- Operating system: Win10
## Dependencies

jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.1 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
numpy >=1.7      :  1.11.1 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pyflakes >=0.6.0 :  1.3.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
sympy >=0.7.3    :  None (NOK)



Discussion:
Well, we extended the Editor in Spyder 3.0 so that it can handle any type of file (instead of just Python). That's why we think it's better not to offer any default extension when saving files.

That makes sense indeed but then there is no need for the "Save as type" dialog I think. 

> That makes sense indeed but then there is no need for the "Save as type" dialog I think.

Could you explain

In the screenshot above, there is an empty save as type pulldown menu with no options. If I understand @ccordoba12 correctly, we would have an empty choice by default. However, assume that I do have a choice and it wouldn't hurt if I can just select from a list for pyc, rst, py files. 

This wouldn't change any defaults but still can accomodate for quick access to file types

My main issue (well, first world problems :) ) is that save dialog opens and the untitled0.py is selected then I type something and hit enter without the file extension. Then of course from code completion to syntax coloring everything turns off. 

So I manually find the file add the extension to the file and then reopen it in spyder. I was wondering if this can be a bit easier on the punisment of user stupidity like myself. 

I think we can enable the save as combobox then :-), definitely an enhancement

My inner laziness thanks you 😄 

This is one issue you can start to work on @malliwi88.

Hello 

I have [This Pull request](https://github.com/spyder-ide/spyder/pull/3517) for solve this Issue ;) @ilayn, @goanpeca 

@malliwi88 I have made my initial comments on the PR


Resolving patch:
diff --git a/spyder/config/utils.py b/spyder/config/utils.py
--- a/spyder/config/utils.py
+++ b/spyder/config/utils.py
@@ -119,7 +119,7 @@ def get_edit_filetypes():
     other_exts = ['.ipynb', '.md']
     all_exts = tuple(pygments_exts + other_exts)
     text_filetypes = (_("Supported text files"), all_exts)
-    return [text_filetypes] + EDIT_FILETYPES
+    return EDIT_FILETYPES + [text_filetypes]
 
 
 def get_edit_filters():
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -32,6 +32,8 @@
 from spyder.config.gui import (config_shortcut, fixed_shortcut,
                                RUN_CELL_SHORTCUT,
                                RUN_CELL_AND_ADVANCE_SHORTCUT)
+from spyder.config.utils import (get_edit_filetypes, get_edit_filters,
+                                 get_filter)
 from spyder.py3compat import qbytearray_to_str, to_text_string, u
 from spyder.utils import icon_manager as ima
 from spyder.utils import (codeanalysis, encoding, sourcecode,
@@ -1302,7 +1304,11 @@ def file_saved_in_other_editorstack(self, index, filename):
     def select_savename(self, original_filename):
         self.redirect_stdio.emit(False)
         filename, _selfilter = getsavefilename(self, _("Save file"),
-                                               original_filename)
+                                               original_filename,
+                                               get_edit_filters(),
+                                               get_filter(get_edit_filetypes(),
+                                                          osp.splitext(original_filename)[1])
+                                               )
         self.redirect_stdio.emit(True)
         if filename:
             return osp.normpath(filename)


Test patch: