Skip to content

Consider using activationHooks to prevent impacting atom boot time #30

@MarcPorciuncula

Description

@MarcPorciuncula

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions