I used to use Jetbrains’ IDEs, each of which included some really nice and easy to use debugger tools. Since coming across Upcase I’ve made the switch to Vim, and I’m really starting to miss the debugger tools I had with the IDEs. I found Vdebug, and although it’s pretty handy and covers a lot of what I had available in the IDEs, there’s still a few things missing, or a few things that are noticeably more painful than with the IDEs. I also haven’t figured out a way to use it to debug Rails apps nor Rspec test suites, though that’s more likely due to my failure to understand rather than any shortcoming of Vdebug.
How do you guys debug code when using Vim? Vdebug? Something else? Do you even use debuggers?
I pretty much stick with pry, and even then I don’t use much of its functionality.
We did a Weekly Iteration on this topic that you might like: https://thoughtbot.com/upcase/videos/interactively-debugging-test-failures
With TDD you shouldn’t often need to use a debugger if your tests are granular enough.
The times I use a debugger tend to be when I’m exploring code which is lacking tests.
One technique I sometimes fall back on is to have better_errors installed, and then intentionally raise an uncaught exception, e.g.
fail 'stop', to trigger it via a browser request. This gives you access to the repl to inspect the state of the app, and also lets out you easily click explore each stack frame (both within your app and within Rails itself). But there’s not really any way to do this within Vim.
Weekly Iteration? What’s not to like? I’ll definitely check that out, thanks!
Exactly. Unfortunately we have several projects that I wrote before I learned about testing, and we are still supporting some of them. I’ll think over what you’ve said - I haven’t heard of repl before but I’ll take a look at it and see what I can learn. Thanks.