[Request] Saving file with correct extension


#1

The editor has the ability to use syntax for specific languages, why can’t the save file dialog have the extension already filled in? Just a small request, but saves a lot of time.

As of now: Trying to save a C source file, you must add the .c extension
Requested: Trying to save a C source file, the C extension is already set in the save dialog.


Saving doesn't pick up on the file type
Pull request that gives items more control over the save process
#2

I think that’s reasonable.
If someone has a specific syntax language selected in an unsaved new document, the extension could be pre-populated.

Of course not if no language has been selected yet.


#3

I’d really like this too.

And (for package developers) a way that will allow pane items to participate so they can ensure they get saved with the proper extension too.

This pull request might be a start:

With it in place the TextEditor class could then implement:

getSaveOptions: ->
if grammar = @getGrammar()
  {} =
    filters: [
      name: grammar.getName()
      extensions: grammar.getFileTypes()
    ]
else
  {}

This isn’t a final solution by far. I don’t know much about how grammars are supposed to work grammar.getName and grammar.getFileTypes are imaginary APIs. Also I’m not sure if the system file dialogue allows you to opt out of using a suggested type name… it should.

Anyway my two cents and why I think something along the lines of my pull request could be useful.