castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
423 stars 26 forks source link

Feature request: Spawn one language server per workspace folder? #228

Open bdchauvette opened 2 years ago

bdchauvette commented 2 years ago

Hello! Thanks for all your work on solargraph! πŸ™‡

I'm using a multi-root workspace setup to with a mixture of ruby/rails and non-ruby workspace folder.

I've gotten solargraph to work OK for most application code, but I'm having no luck getting it working with gems.

I know rails support is a WIP, but I think the biggest problem I'm running into is that the extension launches one server process to deal with the entire multi-root workspace. If I understand correctly, this behavior prevents using bundler to launch solargraph (cf. https://github.com/castwide/vscode-solargraph/issues/164#issuecomment-602090075). However, I can't seem to configure solargraph to find any of my gems without using bundler to launch solargraph.

So! I'm wondering what your thoughts are on launching a language server instance per workspace folder? TBH, I'm not sure what the trade-offs would be (aside from more memory), but at least with my use case, I would benefit from being able to e.g. start multiple server instances using bundler.

I would be happy to do the implementation for this, but I wanted to check if matches your goals for the project before doing any work on it πŸ‘

castwide commented 2 years ago

One possible issue with gems is that you might need to generate YARD documentation by running yard gems. More information: https://solargraph.org/guides/yard

I would prefer to run one language server per editor by default to preserve resources, but I can understand the benefits of running one server per workspace folder. How about making it an option? It could be controlled with a boolean VS Code setting, e.g., solargraph.multiserver, that defaults to false.

This would almost certainly be a pure function of the VS Code extension and not require any changes to the Solargraph gem. If you'd like to implement it, I'd gladly accept a PR and provide whatever help I can.