menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Theia

Eclipse Theia - Cloud & Desktop IDE

Channels
Team

Multi-root workspaces: How to spawn one LS per root?

May 20, 2020 at 10:45pm

Multi-root workspaces: How to spawn one LS per root?

May 20, 2020 at 10:45pm (Edited 2 years ago)
So far we've been using clangd from <at>theia/cpp, but this Theia extension contains workarounds to feed multiple configurations to a single instance of clangd. It looks like it would be much more scalable to have Theia spawn one LS per workspace root until clangd natively supports LSP's multi-root settings.
I would like to know if this is already implemented, and if not what are our options?

May 22, 2020 at 10:28am
I had something like this working in the Che 6 IDE: a policy that would allow to spawn either one LS per project or one for the whole workspace. The problem is that the adapter from the VS Code extension to the LSP that Theia uses (https://github.com/Microsoft/vscode-languageserver-node#readme) does not support such a policy. IMO, it would be super interesting to contribute such a setting to the framework.
Edited
Or maybe you can do it inside the framework, I don't know. The problem, as I remember it, was that you had to dispatch requests to the proper language server based on the URI, and for some results from the language servers, you had to remember which language server they came from in order to direct follow-up requests to the proper one.
like-fill
1
I think this question is moot, since the Theia language client will be soon removed. In a VS Code extension one can spawn a new language client whenever a file is opened from a new, independent (non-nested) root: https://github.com/microsoft/vscode-extension-samples/blob/master/lsp-multi-server-sample/client/src/extension.ts#L55
Edited
The sample extension I linked above should still work in Theia, correct? It's just that there is no way to set this behaviour so that it's automatic and controlled by a policy? Or do I misunderstand?
Edited

May 23, 2020 at 10:18am
It would work, but without looking inside the LanguageClient implementation, I have not idea if it does what we want. In particular, I don't know how requests are dispatched to the various language servers and how results are merged. We'd have to understand whether the default algorithms in monaco are what we want.

May 25, 2020 at 7:14am
Does it mean that vscode-languageclient does not respect WorkspaceFoldersServerCapabilities.supported?
I would expect that this library looks at this property and then decides whether to start a LSP per a workspace root or for the entire workspace.
Edited

May 25, 2020 at 7:33pm
That might seem reasonable, but I just don't know if that's the case.

May 27, 2020 at 6:01am
It should not be different in VS Code.