eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.11k stars 2.5k forks source link

Use IConnection to communicate between plugins and Theia #3605

Closed svor closed 5 years ago

svor commented 6 years ago

Need to implement a way to communicate between the plugin and Theia via IConnection. It should be a general solution for different implementations of Language Server and Debug Adpater to make it possible to send and receive json-rpc messages.

For example when the plugin wants to start Language Server it has to have an ability to register IConnection to make it possible to communicate with the client of Language Server which was created on Theia.

Also we need to have some registry of IConnection because at the same time can be created many connections between plugins and Theia.

cc @evidolob @tolusha @tsmaeder @benoitf

akosyakov commented 6 years ago

Why plugins should use LanguageClient from Theia frontend? Can they create own instances of LanguageClient from pure vscode-languageclient-node package as VS Code extensions do it? Such instances contribute language features via vscode extension API, implemented by theia plugin API.

tsmaeder commented 6 years ago

@akosyakov no, the vscode-languageclient-node uses api from the vscode namespace, which is explicitly not available to theia plugins. @benoitf

svenefftinge commented 6 years ago

I think we should change the architecture on the backend so, that there is an inversify scope per frontend (we could bind it to the lifecycle of websocket connection for now). Anything injected in within that scope would be using that connection, so we would no longer need to broadcast messaged to all clients if we don't want to. Still the outer global scope can be used to have shared functionality and state, like e.g. the optimized file watcher.

This would also mean that we would start a plug-in per frontend connection, but I think that's just right. @akosyakov has prototyped this approach very locally for having a command service within the debug adapter. I think this should be changed across Theia.

tsmaeder commented 6 years ago

@svenefftinge How is your comment related to this work? I don't understand.

akosyakov commented 6 years ago

@tsmaeder MonacoLanguageClient on the frontend is implemented by shimming relevant vscode apis, which is not quite trivial to maintain. With plugin system, I've hoped just use vscode-languageclient-node in theia plugins and forget of maintenance effort of MonacoLanguageClient. Would not it be easy to allow explicitly to use vscode api from theia plugins?

svor commented 5 years ago

solved by https://github.com/theia-ide/theia/pull/3653

0xTheProDev commented 5 years ago

@akosyakov Should we have a separate extension/plugin alongside for broadcast? I am working on PoC, I can push changes if you guys are interested.