Command Palette bug?


#1

I think I’ve found a bug regarding the command palette but I’m not sure which part of Atom (on GitHub) is responsible for it and so where to add it as an issue.

When you add new actions (keybindings) to a package and reload the view, they action/keybinding is not visible in the command palette (shift-cmd-p) until you’ve executed some command from it. Only after that you see the newly added command in the list.

By the way, what’s the difference in what the keybindings in lib/package-name.coffee and keymaps/package-name.cson respectively do? I guess the one maps the keybinding internally and the other one maps the keybinding to the command palette? Thanks!


How do you configure/use snippets?
#2

Keybindings aren’t added in lib unless I’ve missed something big. Commands are added in lib generally and then keybindings to those commands are added in keymaps. Commands show up in the Command Palette regardless of whether there is a keybinding mapped to them.

From what you’re describing, this is expected behavior. My assumptions are:

  1. You have a package that has one or more activationEvents
  2. You are adding keybindings that do not map to those activationEvents
  3. You reload the window, check the Command Palette and the keybindings are not there

If you want the contents of a package to be available from the moment you start Atom or reload the window, then you need to remove the activationEvents. Activation events are a way of deferring the full activation of a package until some command is requested by the user.


#3

Ah sorry I meant commands, not keybindings in the lib file.

By activationEvent, you mean the following method?

lib/package-name.coffee
module.exports = PackageName =
  modalPanel: null
  subscriptions: null

  activate: ->    # <- this one?

I commented out the activate part but the commands are still not being shown in the command palette after I reload the view.

  1. Yes I added the activation method and I added the commands to it.
  2. Yes, I didn’t add a keybinding that maps to the activation method
  3. Yes

#4

I think @leedohm is referring to the activationCommands field in your package.json, for instance these are the activation commands for the find-and-replace package:

When this field is set, the activation of the package is delayed until one of the events is triggered.


#5

Thank you so much, it took a while but now I get it.