

If you just want to get an overall picture of the code behavior in hopes that may help you find out where things are going wrong? AppMap is a tool that can help with that, and here's a post here on dev.Download Visual Studio 2022 Preview External Sources node in Solution Explorer By enabling debugging we can make this already useful (and free!) IDE is even better. So that is the end of this article on debugging a Rails server with Visual Studio Code. Below is an image of what the variables section should look like. Another decision you can make is to have a look at the state of variables and much more information just by looking to the left of the screen. If you were in a browser it should open VS Code and wait for your next move.Īt this point, you can decide to just carry on normal execution by pressing continue (f5) or step over (f10), there are a few more options. Now if I call this method it will pause when it reaches the breakpoint. So I have put a breakpoint into my code and let's see what happens. Now that the server has been started in debug mode we can add some breakpoints to step into the code and see what is happening.


Now if you click Run with the Rails server option selected in the drop-down it will start up in debug mode and a little menu will appear at the top of the screen with debug options such as continue and step over. Depending on the version of Ruby you are using you will need to install slightly different gems.Įnter fullscreen mode Exit fullscreen mode Once that is done we need to install the gems that actually do the debugging that the IDE can use to display. This plugin does much more than just enabling debugging but I’ll let you find that out for yourself, the information on the plugin’s page is a good start. So the first thing to do is install the Ruby plugin in VS Code. Setting it up is actually really easy as some awesome people have made some plugins and gems for us to use. But I got stuck recently and it took me a long long time to figure out what was going wrong and started to wish that I had a debugger setup. Now the only reason I haven’t needed to debug so far is that I am still learning Ruby and Rails and therefore the code I am writing isn’t exactly the most difficult to fix when something goes wrong. I have been using Visual Studio Code as my IDE while coding in Ruby as I didn’t want to fork out a load of money to purchase RubyMine and so far have been getting by without being able to debug my code.
