-
Notifications
You must be signed in to change notification settings - Fork 166
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
Allow custom gemfile for debug #2707
Allow custom gemfile for debug #2707
Conversation
investigating CLA status |
I have signed the CLA! |
Thank you for the contribution, but I don't believe this solves the problem reported in those issues. The fact that we point to the composed bundle under I believe the issue behind the problems reported is that the Bundler settings that we detect and adjust during booting the language server are not passed to the environment we use to launch the debugger. If my suspicion is correct, the solution is to have the language server return the Bundler settings as part of the initialize response and then have the extension merge the settings into the Ruby object's environment, so that launching the debugger is guaranteed to use the environment we configured with the composed bundle. |
Perhaps there are multiple issues then? My specific issue was that the lockfile you are generating in the lsp directory is getting different dependency versions that my application lock file.
|
If that happened, then the issue is rooted elsewhere and has consequences that extend beyond debugging. The language server itself would index incorrect dependencies if that happens, which is not solved by this PR. Our composed bundle should always be based on your project's lockfile and we only request updates for the Whenever the lockfile is modified or the LSP is booted, we check if the main lockfile matches exactly the same versions as when we last booted and if not, we re-generate the composed bundle to avoid mismatches. Now, it could have gotten into a bad state due to some bug either in the LSP or in Bundler. For example, there was a recent Bundler bug where running For ensuring that they are sync again, I'd suggest removing the entire directory and then reloading the editor/rebooting the LSP |
Motivation
Potentially closes:
#1767
st0012/ruby-lsp-rspec#33
When triggering debug (run and debug) from the editor, this extension was setting the env BUNDLE_GEMFILE to be the RubyLsp generated one, not the workspaces one.
Implementation
I added a new setting,
rubyLsp.debugGemfile
, allowing users to specify the Gemfile to use for debug runs. This way, no users are affected by this change unless they opt in.Automated Tests
When I try and run the tests, I get this error. So I haven't bothered to write one for this change.
AssertionError [ERR_ASSERTION]: Ruby bin path does not exist /opt/rubies/3.3.4/bin
Manual Tests
You can see this test in action by triggering debug runs from the editor. If you set the setting, you should see the value of the BUNDLE_GEMFILE change in the output of RubyLsp when it dumps all the envs into the output.