-
Notifications
You must be signed in to change notification settings - Fork 172
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
Debug not working #1785
Comments
Hello! Thank you for the bug report and the kind words about the project. There's a chance that the two issues aren't related, so I'd like to start by understanding the first one. It's been a while since I last used RSpec, but I think our default launch configuration isn't going to work. It's designed to take advantage of Minitest and Test Unit's autorun behaviour. You probably need to change the launch configurations into something like this {
"version": "0.2.0",
"configurations": [
// ...
{
"type": "ruby_lsp",
"request": "launch",
"name": "Debug spec file",
"program": "bundle exec rspec ${relativeFile}"
},
// ...
]
} You may also be able to use line numbers to run the test currently under the cursor, since RSpec supports that. {
"version": "0.2.0",
"configurations": [
// ...
{
"type": "ruby_lsp",
"request": "launch",
"name": "Debug spec example",
"program": "bundle exec rspec ${relativeFile}:${lineNumber}"
},
// ...
]
} Please, let us know if this makes the launch debugging work. This is the one through the |
Thanks @vinistock for the response. It doesn't appear that this is making things work unfortunately. It doesn't look like anything happens (it's just hanging), although when I try to start a new debug session through the status bar button I get:
Let me know what ya think! Thank you! |
This issue is being marked as stale because there was no activity in the last 2 months |
Hey @vinistock Let me know if you're still able to help me get this working! If I can get vscode breakpoints working in my test suite that would be a game changer and I can definitely write up some docs/blog post helping other folks get set up too! |
Definitely! Sorry for the delay. I can't really reproduce the issue you're having, so would you be willing to to debug the extension so that we can understand exactly what's happening? We can add a breakpoint on this line and verify if we're receiving the expected messages back from the debug process. I suspect something might be failing there. Also, there are some new logs we added to VS Code's To test this out locally, you need to
|
Hey @vinistock thanks for your help! I followed these instructions and here's what I observed:
Please let me know what ya think a good set of next steps are!! |
If you try to boot the debugger manually from the terminal with the exact command we ran, does it show any output? bundle exec rdbg --open --command --sock-path=/tmp/ruby-lsp-debug-sockets/ruby-debug-my_repo-1.sock -- bundle exec rspec spec/domain/money_spec.rb |
No – it just hangs 🤔 |
What happens when you do this:
It should hit a breakpoint with output like:
And it should print something like:
It likely means |
Yes, this works for me and hits that breakpoint and I see that output.
This just hangs for me.
This folder exists for me and that command also hangs for me. Thanks for both your help here. Let me know what you think might be be a good path to investigating the hanging command execution 🤔 |
Not sure why debug is hanging, but if it is working without specifying the socket path, then I believe Shopify/vscode-ruby-lsp#876 will end up fixing this. |
Okay – I'm happy to just wait until that's merged and try again! If any new insights come to mind with respect to the hanging, I'm all ears! Thanks again for the help and helping build this game-changing toolchain for Ruby!! 🙏🏼 🙌🏼 |
This issue is being marked as stale because there was no activity in the last 2 months |
Hey @vinistock , I tried pointing to In the ruby-lsp output, I see this:
|
I also tried switching to the VSCode pre-release extension and it did not resolve the problem – the output just hangs and there's no other observable behavior. |
PR Shopify/vscode-ruby-lsp#989 changes when we throw the debugger error from I'm hoping it will make it easier to diagnose whatever is failing here. Also, are you positive that the version on |
I'll definitely retry once that PR is merged so we have more verbose output to debug. I think I'm positive I'm running on main. It looks like that change is in Has there been a pre-release (or release) of the editor extension since that PR has merged? Seems like even the pre-release version of the editor extension has not yet incorporated this change. Not sure how to point to |
I just released new versions which include the changes I mentioned. Can you please try again? And if it doesn't work, is there any backtrace in the debug console that helps diagnose? |
Hey @vinistock thanks for the update. I tried with It didn't work unfortunately – still seeing the same output as before (no backtrace in console). |
Could something be redirecting the STDOUT, STDERR pipes somehow? I'm honestly clueless as to why there's no backtrace showing some problem. @st0012 any ideas? |
### Motivation Closes #1767, closes #1785 Merge the composed bundle environment into the workspace's Ruby object. The language server sets up the composed bundle environment, returns it, and then we merge that into the Ruby object to ensure that any other parts of the extension are using the exact same environment. This fixes a few issues people have been experiencing with the debug client. ### Implementation Started merging the composed environment into the Ruby object and then started relying on that for the debug client. ### Automated Tests Added some tests. I will follow up with another PR that creates an integration test for a scenario that currently fails.
Operating System
13.2.1 (22D68)
Ruby version
3.2.0
Project has a bundle
Ruby version manager being used
rbenv
Description
Hi! I'm excited to try to use VSCode's breakpoints to debug my tests and application code instead of
binding.pry
. It will be a game changer when I can get it working!I followed the instructions in the README to create my
launch.json
, which looks like this:Note that I'm working in a rails app that uses rspec.
I then try to enter the debugger in one of two ways:
Please let me know the recommended approach to move forward here. Also happy to provide any other information that will be helpful for debugging. Note that otherwise, my
ruby-lsp
is working exactly as expected. Thanks for working on and releasing such a great toolchain for the ruby community!The text was updated successfully, but these errors were encountered: