Oftentimes, files are named at liberty, and with complete disregard for any “extension” conventions.
I have now a bash script which is curiously named as
00_generic_test.sh.template – and in context, it is a decent name for its purpose. Importantly, it’s version-controlled and referred to alot from other code; so trying to rename the script is not worth any while.
The pain with Atom is that it thinks this file is JSON. Despite the proper shebang line and executable permissions on the file.
… This actually pounces me every time I open the file, by throwing a bunch of “invalid syntax” markers at me – highlighted, of course, with bright red background of the “One Dark” theme.
Yes I found this petty “customization” point (??) – which basically all can do is to add even more misdirected [file extension → language] mappings. Can an editor do better than this?
If I were to write an Atom package which, let’s settle for simplicity, would detect
#!/bin/bash shebang line and set the buffer language accordingly – which Atom APIs I could rely on to accomplish that?
atom.workspace.eachEditor() going to cut it, performance-wise? What if many more content signatures get added?
Are there any previous efforts I didn’t find (I didn’t find any) in the direction of, roughly, bringing GitHub’s linguist into Atom?