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:
if grammar = @getGrammar()
This isn’t a final solution by far. I don’t know much about how grammars are supposed to work
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.