Filetype independent syntax highlighting?


#1

I’ve been toying with making atom my main text editor, but there is one thing that has been really bugging me. It’s a relatively minor thing I guess, but coming from vim (where it was easy to do) it’s hard to do without. As an organizational tool I would like use comment tags to mark areas of code: e.g.

// NOTE(username): ...
## FIX(username): ...
;; DEBUG(username): ...

I do this in many different file types, so it’s not as simple as editing a single grammar file I think. Is there a way to add a syntax highlight to all filetypes? I noticed that TODO already has this, is there any way to add to this syntax highlight rule? Even better, if I wanted to implement this on my own, where would I need to look to do something like this?


Is there a way to escape from another language grammar?
#2

The magic, as I understand it, is here:

The injectionSelector determines in which scopes to “inject” the TODO grammar into, in this case comments (in any language) and plain text.

So you at least have to have a scope to inject into … though perhaps * would work if you really want something to be available anywhere.