vscodenpa / testissues

Clone of the vscode issue stream.
43 stars 23 forks source link

`onCommand:abc` activates extensions when executed from command palette, but not when executed programmatically with `vscode.commands.executeCommand` #575

Open vscodenpa opened 2 years ago

vscodenpa commented 2 years ago

Does this issue occur when all extensions are disabled?: N/A

Steps to Reproduce:

  1. Create an extension A, that contributes and registers a command "abc".
  2. Create an extension B, that has an activation event for "abc", i.e. onCommand:abc.
  3. If you execute "abc" from the command palette, then extension B is activated as expected.
  4. If you execute "abc" programmatically with vscode.commands.executeCommand, then extension B is NOT activated.

Some background for our scenario: We want to support other extensions interacting with our own, in such a way that activating our extension automatically causes the others to be activated (so they can call our API and supply some things that will immediately be needed). It would be possible to copy all of the activation events from our extension, but there are a lot, the list is changing often, and it would be error prone.

An ideal solution would be an onExtension:extensionId activation event that the third party extensions could use. But, alternatively, a command registered by and called by the primary extension could activate the others, if they have activation events for it. This works if that command is called from the palette but not if it's called programmatically.

Another approach would be for the primary extension to directly activate them with vscode.extensions.getExtension(...).activate(), but that requires having the primary extension know the IDs of the third party extensions, which is not ideal for our scenario.

/cc -isidorn

vscodenpa commented 2 years ago

confidence for label extensions: 0.7. does meet threshold

vscodenpa commented 2 years ago

confidence for assignee jrieken: 0.75. does meet threshold

vscodenpa commented 2 years ago

confidence for label extensions: 0.7. does meet threshold

vscodenpa commented 2 years ago

confidence for assignee jrieken: 0.75. does meet threshold

vscodenpa commented 2 years ago

confidence for label extensions: 0.7. does meet threshold

vscodenpa commented 2 years ago

confidence for assignee jrieken: 0.75. does meet threshold

vscodenpa commented 2 years ago

confidence for label extensions: 0.7. does meet threshold

vscodenpa commented 2 years ago

confidence for assignee jrieken: 0.75. does meet threshold

vscodenpa commented 2 years ago

confidence for label extensions: 0.7. does meet threshold

vscodenpa commented 2 years ago

confidence for assignee jrieken: 0.75. does meet threshold