Activate extension if other extension is activated #595
-
I wrote an extension that depends on data generated from/provided by another extension ( I browsed through the documentation and the sources of vscode, but I wasn't able to find a solution for this. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
If your extension is activated first you can use the extension api to activate the extension you depend on. |
Beta Was this translation helpful? Give feedback.
-
Hi @itavero , There is not such event, as you can see here https://code.visualstudio.com/api/references/activation-events. You can say your extension depends on another extension, using the Right now, the only way is to check if the let msext = vscode.extensions.getExtension("ms-vscode.cmake-tools");
if (!msext.isActive) return;
... Otherwise, I suggest you to open a feature request in VS Code repo, so the team could take a look and evaluate the scenario you describe. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Both of these require code in the primary extension (the one that activates first), but these are two options I've used in the past--
I would love to see an issue filed on VSCode that would add a proper activation-on-another-extension-activation, so that code is not needed in the primary extension. |
Beta Was this translation helpful? Give feedback.
-
Wouldn't this work with |
Beta Was this translation helpful? Give feedback.
Hi @itavero ,
There is not such event, as you can see here https://code.visualstudio.com/api/references/activation-events.
You can say your extension depends on another extension, using the
extensionDependencies
entry in package.json (more details here https://code.visualstudio.com/api/references/extension-manifest), but this entry is for installation purposes, not activation.Right now, the only way is to check if the
ms-vscode.cmake-tools
is active prior to run your commands/handle activation, using the the Extensions API (https://code.visualstudio.com/api/references/vscode-api#extensions). Something like: