When do language packages load?


#1

If you have a language package that includes some other instructions in it (keybindings, commands, whatever), is the non-grammar code loaded with all the other packages, or when the grammar is selected for a buffer?


#2

I believe all of a package’s contents load at the same time. A grammar isn’t used to parse and tokenise an actual file until it’s needed… but Atom still needs to read metadata about the grammar, like filetypes, the grammar’s name (for listing in menus, etc), and most importantly, the scopeName attribute, which pretty much uniquely identifies a TMCG.


#3

That’s what I’ve been going with as my assumption, yeah.


#4

All packages load at the same time, on Atom startup. Some packages don’t activate when they are loaded.


#5

Is this determined solely by the package itself?


#6

Yes, see the section on the package.json mentioning activationCommands and activationHooks in the Flight Manual:

http://flight-manual.atom.io/hacking-atom/sections/package-word-count/


#7

Thanks. I knew about those keys, but I wanted to verify that there were no other elements that would influence the timing of a package being activated.