New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error starting ruby-lsp when customizing rubyLsp.bundleGemfile
#1975
Comments
When you set Lines 45 to 46 in f6f42b1
|
@g-arjones this is documented in the VS Code extension's README. Also, this issue is not related to using a custom bundle. @nholden for cases where the Ruby project is nested in a sub-directory, you have to configure that directory as a workspace using VS Code's multi-root workspace features. We have documentation on multi-root workspaces here and the Ruby LSP itself is a multi-root workspace. You can find our own configs here. The custom bundle feature is intended for users who have a separate Gemfile for their developer tools or for projects that are using EOL rubies. Please, let us know if you have any doubts so that we can improve the docs. |
What do you mean? |
The custom bundle is only intended to be used in two scenarios: if your project is using a Ruby version past its end of life (< 3.0) or if you use a setup with a separate Gemfile for your development tools (some users don't like putting formatters, linters and other tooling into their project dependencies). The scenario described here is a multi-root workspace, which is natively supported by VS Code and the Ruby LSP. As long as the |
Where is that described? What I see here is a single project/root but he keeps his |
Tools like language servers need to be able to determine where the root of workspaces exist, so that they can discover the It tells all VS Code extensions (and the editor itself), these are the relevant workspaces inside this project you may need to activate on. It's the way that VS Code users can configure monorepos. Conceptually, the Without workspaces, there's no heuristic that would allow us to launch the language server and always have it work. In this particular use case, being able to point to the location of the Some users have private gems defined inside a monorepo, inside many levels of nested subdirectories, alongside a main application. Others just have a single application and nothing else. Some have the There's no blanket rule that would account for all possible scenarios, which is why we rely on the user configuring their monorepos using VS Code's multi-root workspace feature. As I mentioned, this is exactly the scenario for the Ruby LSP itself. The top level of this repository is a gem and the |
I have to disagree. Where I put my Gemfile does not dictate where the root of my workspace is (let alone how I name it). The location and the name of the Gemfile are irrelevant, bundler itself allows users to put their Gemfile wherever they want and name it whatever they want through the Now, you as developers of My project has the gemfile in a separate folder with nothing else (not even ruby files) and I'm pretty sure that's not the root of my workspace. Everything works fine, the solargraph language server works fine, bundler works fine, vscode works fine, other extensions and tools work fine. The only thing that cares about my gemfile being |
Thank you, @vinistock! I've created a new multi-root workspace, and ruby-lsp is working. My team is trying it out today.
I think it would be helpful to add a note to the bundle gemfile extension setting in VSCode. That setting looked like exactly what I wanted, so I was surprised when it didn't work. Would be helpful context there to know what the setting is intended for and that you must use a multi-root workspace if your Gemfile is located in a subdirectory. |
I'm glad to hear it's working. I tried expanding on the setting description, but the challenge is the length of the text #2011. Do you have any suggestions that would make this clearer? |
I think that's perfect. Thank you! 🙏 |
Description
I have a project that contains all Ruby files in an
./api
subdirectory. Today, I have a./Gemfile
and a./api/Gemfile
, but I'd like to only have a./api/Gemfile
.Whenever I try to set the
rubyLsp.bundleGemfile
setting to./api/Gemfile
, I see this error in the Ruby LSP output:I confirmed that
/Users/nickholden/.gem/ruby/3.2.2/bin/ruby-lsp
exists on my machine. I don't see this error when I don't setrubyLsp.bundleGemfile
, and I always see this error whenever I set any value forrubyLsp.bundleGemfile
.I have
ruby-lsp
installed via the VSCode extension (latest version).Any troubleshooting suggestions?
The text was updated successfully, but these errors were encountered: