-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plug-in System #1482
Comments
Just asking, how would the rendering part of plugins fit into this picture? At some point those plugins want to render something, right? |
It would be nice to evaluate whether we could just support the VS Code extension API. |
@AlexTugarev sure it's a question that come quite often. it's flexibility over control. It's where you put the cursor between customization and maintenance. |
@svenefftinge funny that you add that comment as we were also thinking at a time to have an abstract layer on top vscode extension API allowing vscode plugins to be easily migrated as well. (it may work out of the box for many plugins as well without changes in vscode plugins) Based on the previous comment, vscode is clearly preventing any UI rendering from extension while theia API could authorize in some way that. vscode model also use the lazy loading pattern. (activation events) |
I don't think we can/should run VS Code extensions in web workers:
|
@akosyakov about the first point, extension can be run on the server side (with threads instead of worker or with libs like https://www.npmjs.com/package/tiny-worker) as we're still sending messages we can use any node dependencies in that case. But yes obviously it means that we send more messages between client and the server. |
but maybe vscode extension support can be discussed in another issue :-) |
I would say we either support vscode extension through this or not. It doesn't make sense to have two different sandboxed / high-level extension mechanism, does it? |
As you already started prototyping on this (https://github.com/theia-ide/theia/tree/isolated-extension-api), I'd like to get the discussion going on why we just can't support the VS Code extension system instead. It seems to fulfill all the requirements you listed above? The advantages are:
|
I think that some arguments were given by Anton. VScode assume that extension is running close to the client (Desktop IDE). So while you're talking on a big advantage, you may also have a lot of network usage when client and server are separated. Also it's difficult to follow a model that is evolving on its side, so you might not be 100% compatible as well. You could have a "emulated vscode layer" with 'try do the best` but you could never assume it's 100% compatible. |
Could you be more concrete about your concerns? Which information don't you want to send over the network and why could we never support the API fully? I think the benefits are compelling so we should have very good reasons to invent our own thing instead. Also please list any drawbacks you see. |
Is not it our case that we have a powerful scalable backend and potentially limited on resources frontend? I imagine a worst case as someone who has a budget laptop and wants to use remote workspaces with Theia. Would she be happy to find out that extensions are doing some heavy networking and computations in multiple web workers? How could it be prevented with web workers? How could we control communications? How can we scale it, ask her to buy a new laptop? Giving that would not it be reasonable to exploit the backend as much as possible and don't overuse the frontend? VS Code assumes that both frontend and backend are running at the same distance to all heavy resources, as documents, filesystem, git and so on. The most of these resources are on the backend already. We can bring the rest by moving relevant frontend state to the backend via controllable syncing, as @svenefftinge suggested for documents: #1470. By controllable I mean that our code will be responsible for all communications between frontend and backend to keep them low and small. With having it we are back to VS code case and can run extensions efficient on the backend without misusing frontend resources. Extension developers will be able to use familiar backend apis, as Node.js, and VS Code API (or similar) to access the frontend state from the main process. The latter, being implemented by us, let us as well control communications between extensions and frontend again to keep them low and small. |
I will not on this comment on which API model to stick but more on the global picture. All model can be plugged as it's quite a high level view that I'm showing. That said, for some case, we require to have plugin running on the client side, for some other cases we can use server side. so instead of choosing for users, they could have the choice. (we may say one is the default like using any nodejs module so being server side plugin) Note : the same API is exposed for plugins whatever they will run on client’s side (like in worker) or on server side (inside nodejs instance) For Che, plugins to load will be defined when Theia docker container will start. Plugins could be provided through an environment variable to the container. (it could use a different mechanism, like providing REST API endpoint to grab it, etc) Probably, registries will have to be provided to theia container as well. So, providing list of plugins should also provide on which registry they’re located. Example of what could be done for the “bootstrapping of the container” Provide registries (with json or yaml format)
Then plugins could be described by using their registry as prefix. Env variable PLUGINS: npmjs/my-custom-plugin@2.0.0,github/johndoe/customplugin@1.0.0, maven/org.eclipse.che:che-custom-plugin:1.2.3:zip So the extension manager is able to collect all plugins that need to be installed, from which registry, and each type of registry provides how to grab resources. At this point, container knows what are the plugins to install, and how to grab them. Backend HandlingHere is an example of what could do the theia backend. Metadata are analyzed by some scanners that can be plugged and contribute to Theia plugin’s metadata available both from frontend and backend extension manager parts. Note: to speed up the install of plugins, all plugins should be “precompiled” if they have external dependencies or static requirements. (This is mainly because the startup of a workspace should be as fast as possible) Frontend HandlingWhen the frontend is starting, it should exchange data with backend in order to get what are the plugins to start on browser side and also to get backend plugins commands to register lazily (we register the command but plugin is loaded only when we first call this command) APIAll resources added through high level API (disposable resources) when plugin is loaded should be automatically cleanup if plugin is disabled. → Provide a way to refresh the whole frontend/backend if a plugin is disabled if user want to be sure it’s cleanly removed User experienceFor development mode, add a new “tab browser” with a new instance of theia running with the plugin being currently developed. (hosted mode) |
@akosyakov @svenefftinge do you have comments on my previous comment ? does it fit well for you on global picture ? |
Hey @benoitf, |
yes we could discuss that in a meeting. BTW I don't see why we could not let the user to write code that could run on frontend. (developer may have the choice even if default is server side where you can use all nodejs API) Let say I want to implement a There are many other cases where you want to have plugin executed on frontend but it doesn't mean all of them need to be executed on frontend side as well. (When you design the plugin you could just pickup which side) Also it is still compliant if someone want to apply vscode mode. In that case these |
We had a meeting and agreed on the following approach:
Regarding VS Code API support, @gorkem raised concerns that it will be hard to maintain and achieve 100% compatibility, due to its lack of a real spec. The surface is indeed huge and directly going for that as the ultimate goal would consume many developer hours (and nerves ;-)). So it seems to be better to move there in smaller steps with useful intermediate results. |
This is a follow up on the previous issue #1347
Provide plug-in API
There is a current extension model in Theia powered by inversify allowing to use/extend any extension point available but the current model is conflicting with some Eclipse Che goals.
While this model fit nicely the ISV goals, it may not fit for 'cloud IDE developer'
Eclipse Che Goals
Fast loading Che workspace
In Che, a new IDE needs to be loaded each time we create a new workspace. (If user select java, java extensions needs to be loaded, etc)
So, we need to avoid any build/compile operations that can take time. Loading 10 or 100 extensions should be a fast as possible.
Secure loading
As we need to create/assemble/load a new IDE for each workspace, we always need to have something runnable at the end. If one extension is failing, only this extension should be disabled but you should have all the other extensions available and the main IDE there. No blank screen.
We need to avoid as much as possible network operation as well.
Code isolation
Code isolation example
on web worker and performance we shouldn't use
1 web worker per plugin
even if for example firefox limits the number of workers to 512 (can be configured) but too many workers = bad performanceSo probably a pool of webworkers (
< navigator.hardwareConcurrency
) should be usedPOC
example: https://youtu.be/v_a1J_cM5lQ
The text was updated successfully, but these errors were encountered: