less-than-slash icon indicating copy to clipboard operation
less-than-slash copied to clipboard

Consider using activationHooks to prevent impacting atom boot time

Open MarcPorciuncula opened this issue 8 years ago • 0 comments

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?

MarcPorciuncula avatar Mar 05 '16 12:03 MarcPorciuncula