I have a package that works forspecific file-names (installer.cfg
), rather than extensions (although it can be tricked by certain names, e.g. something.installer.cfg
– but that’s a different story!). Now, Atom has the rather annoying behaviour that it saves new files as “Untitled”, without even appending an extension. So I was thinking that I could set the file-name programmatically like this:
atom.workspace.observeTextEditors (editor) =>
@subscriptions.add editor.onDidChangeGrammar =>
scope = editor.getGrammar().scopeName
fileName = editor.getFileName()
if scope is "source.cfg.pynsist" and fileName is null
# setFileName('installer.cfg')
Unfortunately, there is no method to setFileName()
and even getFileName()
is undocumented – so my hopes aren’t high.
Does anybody have an idea whether it’s possible and how?