In package.json you can specify activationHooks, an array of events that will trigger the activation of the package. When you specify activationHooks, your package no longer activates on boot, but the first time when one of these events fires.
Here's an example package.json from the atom docs for a word count package that's activated only for javascript and coffeescript:
{
"name": "wordcount",
"main": "./lib/wordcount",
"version": "0.0.0",
"description": "A short description of your package",
"activationHooks": ["language-javascript:grammar-used", "language-coffee-script:grammar-used"],
"repository": "https://github.com/atom/wordcount",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {
}
}
Since the current behaviour of less-than-slash is to operate on any and all files of all grammars, I'm not sure what event to use to trigger it. I also couldn't find docs on the types of events available to use in activationHooks.
Side thought: should users be able to configure which grammars less-than-slash is activated for?
In
package.json
you can specifyactivationHooks
, an array of events that will trigger the activation of the package. When you specify activationHooks, your package no longer activates on boot, but the first time when one of these events fires.Here's an example
package.json
from the atom docs for a word count package that's activated only for javascript and coffeescript:Since the current behaviour of less-than-slash is to operate on any and all files of all grammars, I'm not sure what event to use to trigger it. I also couldn't find docs on the types of events available to use in activationHooks.
Side thought: should users be able to configure which grammars less-than-slash is activated for?