Why won't my package activate on reload/restart?


Note for future travelers:

It is not clear through the documentation that your package won’t automatically activate on start/reload if you have any activationCommands defined.

Only by inpsecting the source did I come to realize this:

load: ->
  @measure 'loadTime', =>
      @settingsPromise = @loadSettings()
      @requireMainModule() unless @hasActivationCommands()

    catch error
      console.warn "Failed to load package named '#{@name}'", error.stack ? error

Noting the line @requireMainModule() unless @hasActivationCommands().

When I’m finished my current project I’ll submit a PR to add this to the package tutorial but for now I wanted to make sure this was noted - maybe the search engines see it and it saves someone else a few hours of hair-pulling.

Help with using commands

This is mentioned in the documentation, though it was using the old term of activationEvents. I’ve updated the reference (among other things) in this pull request:


What happens instead? Say mumble:foo is my activation event, and then I do this:

  • Start app
  • Invoke mumble:foo
  • (I guess it gets activated here)
  • Reload
  • Invoke mumble:foo again
  • (Does it get activated again here?)


Yes. All packages are inactive when Atom first starts loading. Later in Atom loading process ones without activationEvents are loaded. The rest are only activated when needed.


To some extent, but it’s not clear to a beginner that Atom won’t automatically load your package if you define activationCommands, as the Package Generator provides by default.

Specifically I think calling this behavior out in simpler, more direct terms, would be helpful. Again, it wasn’t until I dove into the source that this became clear.

@leedohm’s PR is solid. It was quickly obvious that activationEvents had been removed for activationCommands and the diff looks sound. That’s just not really what I was intending to call out with this thread (and, as I say, I’m planning to issue my own PR with relevant changes soon).


Absolutely, it could be more clear. Looking forward to seeing your PR!