I’m writing a plugin to Sublime and trying to somehow get expected file extension for unsaved buffer. I have a syntax for the buffer but cannot get the extension from it.
Right now my best shot is to parse syntax file in plugin code (
sublime-syntax file) and just extract first extension from the list. With
tmLanguage it should be easy, as
plistlib library is included in stdlib , but
sublime-syntax files are yaml, and it’s not included in Python stdlib nor in Sublime libs, so I will need an external dependency. All this to do stuff that’s already done by Sublime when saving file.
Maybe I’m missing some API? Is there a simpler way to achieve this?