Restarting Theia Programmatically

I’m trying to implement the VS Code “workbench.action.reloadWindow” command. For example, vscode-java uses it to restart VS Code and thereby itself. I’m a bit confused as to what “restart” would mean for Theia, though. I am thinking that we would have to restart any backend services and in particular all plugins (as they would need to reinitialize). Does anyone have ideas on how to best approach this problem?

[original thread by Thomas Mäder]

sounds like the same problem that @anton-kosyakov solved when we developed the theia-extension runtime installer. We have a main process that (re)starts a secondary process containing the application. How does VS Code do it?

As I understand it, they shut down all contributions and then restart.

But I don’t see a clear lifecycle in Theia.

What’s the theia-extension runtime installer?

Restart the application, not the process, that is.

Anyway, Since our plugin system is open for extension (think running plugins in Che sidecar containers), we’d likely have to introduce some restart logic into a protocol somewhere in order to have a clean restart.

We might have to restart the whole application to clean up any side-effects the extensions made? I.e. registration of commands, etc?

When you reload the page all vs code extensions are reloaded from scratch as well as user session, would not it be enough?

We’ve removed cluster module recently and i’m not keen on retroducing it. It was causing complexity in electron app with different dev/prod setups and additional indirection.

Because a new plugin host process is started? But what of the old plugins? How are they properly shut down? And I haven’t got a clue how we would do that in the case of Che, where the plugin host processes are not started by theia itself.

in pure Theia old host process is shutdown with all plugins and a new is started

it could be done without reload i guess, if there is a programmatic way to ask the host process to reload and it ensures that unloaded plugins properly remove all contributions from main process.

I don’t see such capabilities in HostedPluginSupport, it only can load more plugins, not unload existing

We will need it later if we want to support uninstall plugin UI without page reload as well.

I wonder how multiple windows per a workspace are supporetd in Che if a new host process is not started for each window.

I dont’ think multiple windows will work in Che.

Actually, after reading through a ton of code, I’ve convinced myself that all the plugin stuff (even in Che) is properly connection scoped, so a simple window reload should do the trick.