Using Language Support api on the backend

Hi All,

I see LS for java which can be called from the browser (e.g.)

    protected readonly languages!: Languages;

        if (this.languages.workspaceSymbolProviders) {
            for (const provider of this.languages.workspaceSymbolProviders) {
                    const symbols =  await provider.provideWorkspaceSymbols(param, tokenSource.token);
                    for (var i =0; i < symbols!!.length; i++) {
                        var symbolInfo = symbols!![i]

But when I put the code in the backend (e.g. my code is in [extension]/src/node/backend-service.ts), it throw an exception. I believe it’s because the Language object is on injectable in the front end code. Is it possible to call the Language Support apis in the backend?

@orangepaydev thank you for the question, please note that the @theia/languages extension is soon to be removed: (at the moment it is deprecated).

For this particular example, is there a reason you want the backend to use it? I believe it is possible by using JSON-RPC (like we do in many places currently in the codebase) to be able to use APIs in both browser and node. This separation is described here:

Cool…I can see massive changes between v1.3 and v1.4. My use case is quite unique. I’m doing an inspection of classes in java and on occasion will do a wild card search which might return about 800 plus java classes. When this happens then I could see the websocket layer gets quite chatty. If these were to be performed on the server then only return the subset of result that’s of interest to me.

Managed to get a JSON-RPC hooked up, but the backend code that runs on node will not startup because I’m injecting a front end Object (in this case Languages).