mrhanlon / less-than-slash

Atom.io package for closing open tags when `</` is typed, like in Sublime Text 3.
MIT License
23 stars 6 forks source link

Consider using activationHooks to prevent impacting atom boot time #30

Open MarcPorciuncula opened 8 years ago

MarcPorciuncula commented 8 years ago

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?