castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

Solargraph VSCode Extension doesn't work with Multi-root workspaces #164

Closed ig0rsky closed 4 years ago

ig0rsky commented 4 years ago

First off, thank you for your work :)

Looking at this commit: 212e76d61ac0790a0f15c4263f1bf54b0f9b80ad

I believe that Solargraph VSCode extension looks for the first entry in the workspace list at the moment. Is it possible to refactor the codebase such that it works with any number of folders in a multi-root workspace?

I work with multiple repos and some of them contain ruby scripts. I have to open them one by one for Solargraph to find the right workspace.

It is more than likely that I skipped over a configuration detail. If there is any documentation on how to configure the Solargraph extension such that it recognizes multi-root workspaces, please let me know :)

👍

castwide commented 4 years ago

Thanks!

Solargraph should work with multi-root workspaces. Although the extension sends the first entry in the initial configuration, it sends additional workspace information in a subsequent message, after the server confirms that it supports the workspaceFolders capability. Is it not working for you?

ig0rsky commented 4 years ago

I'm using the solargraph extension with the bundler configuration and for some reason, It won't correctly recognize the workspace folder it's supposed to scan for the Gemfile. I'm not exactly sure what's happening, are there any logs I can monitor to see what the extension is doing? Here are all the extensions that are installed related to Ruby.

$ code --list-extensions | rg "ruby|solargraph"
castwide.ruby-debug
castwide.solargraph
rebornix.ruby
wingrunr21.vscode-ruby
castwide commented 4 years ago

You can use the solargraph.logLevel setting to select the amount of logging you want to get in the debug console.

Using the bundler configuration with multiple Gemfiles in workspace folders is very likely a problem. Solargraph manages the entire workspace under a single server process, which gets started with whatever Gemfile it finds first. You might get better results by opening the workspace with solargraph.useBundler set to false. The mapping process will still make an effort to map the correct gem dependencies in each folder.

ig0rsky commented 4 years ago

thanks!