Che: VS Code Extension API does not work across Extension Host Boundaries

Created on 27 Jan 2020  路  17Comments  路  Source: eclipse/che

A VS Code extension can provide API to other extensions by returning an API object from their activate function (see https://code.visualstudio.com/api/references/vscode-api#extensions.getExtension). This works fine when the extensions run in the same process, but when the extensions run in their own sidecar, I think this will not work.
This is relevant to Che: some very basic extensions like yaml support (https://github.com/redhat-developer/vscode-yaml) use this facility to communicate with other extensions like tekton support.

areeditoche-theia kinbug severitP1 statuin-progress teaeditors

All 17 comments

There are really two approaches to solving this problem in the general case:

  1. Make the VS Code API available remotely in all plugins hosts
  2. Make sure all plugins that need to talk to each other run in the same plugin host.

The second one is really a non-starter, since it does not work in a plugin ecosystem where we do not control all possible combinations of plugins.

I don't know if it's possible to use proxy(remoting) there

@benoitf let's not give up before we try ;-)

@tsmaeder could you please assign the right labels for this issue? which team is expected to work on this issue?

Another consideration with plugins like vscode-yaml is that this issue can create incompatibilities between unrelated plugins, if e.g. kubernetes tooling and quarkus both want to depend on vscode-yaml. It seems (from my testing at least) that only one instance of vscode-yaml will succeed at activating.

It seems (from my testing at least) that only one instance of vscode-yaml will succeed at activating.

And that is the correct behaviour. Duplicate instances of plugins are bad.

@benoitf which team is expected to work on the issue?

@ibuziuk I would say editor as it's related to che/theia ?

@ibuziuk AFAIK no need to assign team anymore no ? area labels are matching teams

@benoitf this is new for me. We still need to assign the teams

Cursory search revealed this. Not sure what it's worth, but it deals with transparent remoting of Javascript objects.

the main issue is that all getExtension() / exports stuff is using synchronous calls (There are no Thenable in the vscode.d.ts defintion for this API) while with RPC/proxys we'll end up with Promises.

Well, we can return a wrapper of the API object synchronously, but if the extensions themselves expose synchronous functions, there is a problem.

getExtension is synchronous on this object you've exports field and then you call exported functions (and it can be sync or async functions)

we can return many wrappers but there is no guarantee that functions are asynchronous at the end.

it's the result of the activate method.
example
https://github.com/redhat-developer/vscode-yaml/blob/master/src/extension.ts#L88
https://github.com/redhat-developer/vscode-yaml/blob/master/src/schema-extension-api.ts#L34-L35

for that case, for void method it could work but not for the boolean one

There are methods to force the remote access to be sync, but I guess that would be a bad thing, probably. But still, plugin API is broken across process boundaries. Can you think of another workaround for this?

I'm still exploring :-/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnmcollier picture johnmcollier  路  3Comments

amisevsk picture amisevsk  路  3Comments

vanzhiganov picture vanzhiganov  路  3Comments

sudheerherle picture sudheerherle  路  3Comments

LaneGeek picture LaneGeek  路  3Comments