Set default syntax for all unknown files


I am dealing with a lot file names that have extensions that aren’t the appropriate syntax.
I have the file mechenergypickup.projectile, that is JSON but it doesn’t have the JSON extension so Atom doesn’t know what to do and defaults to plain text. I want it so that when it has an unknown file extension then it defaults to JSON.
If some one has a solution that would be great.


The easy thing would be to set the file extension for all .projectile files, which you can do via config.cson.

To have all unknown files default to one grammar, you’ll need to write an function that watches atom.workspace.observeTextEditors(), checks the grammar and the file extension of the resulting TextBuffer, and, if editor.getGrammar().name is "Plain Text" and editor.getTitle().split(".", 1)[1] is not "txt", sets the grammar to atom.grammars.getGrammarByScopeName(".source.json").

Deprecation cop, finally annoying me enough to ask for a fix
Set file name programmatically?

You could install the Default Language extension.


:expressionless: thank you for the extention i probably should have looked harder