I’m starting a small extension project for a new sidebar. I only really want it to be available for certain types of projects, but a simple condition on testing for a file doesn’t work:
It appears the extension always gets activated no matter what conditions are in the activationEvents section of extensions.json. Is that a bug or expected / undocumented behavior?
(checking other extensions with sidebars like Go-Bee shows their sidebars also to be available always)
At, yeah. This is a point we should clarify in the docs. Certain extension features always cause the extension to load. One being sidebars, because if they didn’t it might cause sidebar layouts to change unexpectedly on the user if one suddenly wasn’t present for a project.
Another is commands in the menus, although only when invoked by the user for the first time. They’re always present on the menu, though.
actually, thinking about it: I don’t think unactivated plugins would change the users sidebar layouts not change unexpectedly - I would expect it to be handled the same as in development of the plug-in when it’s not activated, right?
Yeah, that totally makes sense. We could not start up the JavaScript code but display a placeholder similar to the above that lets users trigger it manually if wanted.