How to get a plugin instance

Hi, According to my understanding, I can get the plugin instance after click the plugin’s icon in tabbar,
can I get the plugin instance before click tabbar? and are there any corresponding events after the plugin is rendered? thanks

Hi, @gaomin

First off, regarding the last question, you can hook into the onDidCreateWidget event of the WidgetManager class. That allows you to listen to any created widget, even the ones that are contributed by vscode extensions:

@inject(WidgetManager) widgetManager: WidgetManager;
...
this.widgetManager.onDidCreateWidget(createEvent => /* Check the widget id and insert custom code here */);

Regarding your first question: Do I understand you correctly that you’re asking about a vscode extension and its activation lifecycle? Basically every extension is really “activated” after a certain trigger has been called, like opening the associated view or calling a command or something similiar. Is there a certain reason why you’re trying to force the extension to activate before its usual trigger?

Hello,
I want to show the plugin widget view both in my custom view container and the default plugin page.
Now, I can get the plugin widget after click the corresponding tabbar, and can added to my custom view, but this widget is singleton, if I add it to my custom view, the plugin page opened by clicking the tabbar cannot display the widget view.
I try to create a new widget by this plugin widget factory with different options, and I get a new plugin widget, but this widget content is empty, It feels that the initialization process of plugin is not executed.
so I want to manually initialize a plugin and get its widget, not affect the default plug-in page display.
or is there any way to directly quote the plug-in page, just like HTML iframe? or is there any other recommended implementation?

[image]


@gaomin You should be able to inject the HostedPluginSupport class and call the activatePlugin method with the id cweijan.vscode-ssh to force its activation.

However, I don’t think it’s possible to “mirror” a widget so to speak. Instead you should try to hide the other SSH panel, if you have the widget in your custom LDP panel either way.

ok, thank you very much, I will reconsider hiding the SSH panel.