{"id":24608,"date":"2021-12-07T17:50:18","date_gmt":"2021-12-07T22:50:18","guid":{"rendered":"https:\/\/matthewjrodgers.com\/?p=24608"},"modified":"2021-12-07T17:50:18","modified_gmt":"2021-12-07T22:50:18","slug":"how-to-get-a-ruby-debug-environment-working-in-windows-with-visual-studio-code","status":"publish","type":"post","link":"https:\/\/matthewjrodgers.com\/?p=24608","title":{"rendered":"How to get a Ruby Debug Environment working in Windows with Visual Studio Code"},"content":{"rendered":"\n<ol><li>Install Ruby+Devkit from <a rel=\"noreferrer noopener\" href=\"http:\/\/rubyinstaller.org\/downloads\" data-type=\"URL\" data-id=\"rubyinstaller.org\/downloads\" target=\"_blank\">rubyinstaller.org\/downloads<\/a><\/li><li>Install Visual Studio Code at <a rel=\"noreferrer noopener\" href=\"http:\/\/code.visualstudio.com\" data-type=\"URL\" data-id=\"code.visualstudio.com\" target=\"_blank\">code.visualstudio.com<\/a><\/li><li>Navigate in PowerShell to the directory you have your Ruby project folder in and run <code>gem install ruby-debug-ide<\/code>.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\Users\\Administrator\\Source> gem install ruby-debug-ide\r\nFetching ruby-debug-ide-0.7.3.gem\r\nTemporarily enhancing PATH for MSYS\/MINGW...\r\nBuilding native extensions. This could take a while...\r\nSuccessfully installed ruby-debug-ide-0.7.3\r\nParsing documentation for ruby-debug-ide-0.7.3\r\nInstalling ri documentation for ruby-debug-ide-0.7.3\r\nDone installing documentation for ruby-debug-ide after 1 seconds\r\n1 gem installed\r\nPS C:\\Users\\Administrator\\Source>\r<\/code><\/pre>\n\n\n\n<ol start=\"4\"><li>Open Visual Studio Code and install the Ruby plugin by Peng Lv.<\/li><li>Once you have opened your project folder in Visual Studio Code, open one of your Ruby project files. Classic_jazz.rb, for example.<\/li><li>Click on Visual Studio Code&#8217;s debug menu at the left and choose &#8220;create a launch.json file&#8221; and choose Ruby and then Debug Local File. Then, delete the contents of the file and paste in what you see below and replace the name of the file you want to debug in the program value. The file I was debugging was called classic_jazz.rb.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>{\r\n    \/\/ Use IntelliSense to learn about possible attributes.\r\n    \/\/ Hover to view descriptions of existing attributes.\r\n    \/\/ For more information, visit: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387\r\n    \"version\": \"0.2.0\",\r\n    \"configurations\": &#91;\r\n        {\r\n            \"name\": \"Debug Local File\",\r\n            \"type\": \"Ruby\",\r\n            \"request\": \"launch\",\r\n            \"program\": \"${workspaceRoot}\/classic_jazz.rb\",\r\n            \"cwd\": \"${workspaceRoot}\"\r\n        }\r\n    ]\r\n}\r<\/code><\/pre>\n\n\n\n<p>That&#8217;s it! Thank you for reading this blog post!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Ruby+Devkit from rubyinstaller.org\/downloads Install Visual Studio Code at code.visualstudio.com Navigate in PowerShell to the directory you have your Ruby project folder in and run gem install ruby-debug-ide. Open Visual Studio Code and install the Ruby plugin by Peng Lv. Once you have opened your project folder in Visual Studio Code, open one of your&hellip; <a href=\"https:\/\/matthewjrodgers.com\/?p=24608\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to get a Ruby Debug Environment working in Windows with Visual Studio Code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[5,4],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/posts\/24608"}],"collection":[{"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24608"}],"version-history":[{"count":1,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/posts\/24608\/revisions"}],"predecessor-version":[{"id":24609,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=\/wp\/v2\/posts\/24608\/revisions\/24609"}],"wp:attachment":[{"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matthewjrodgers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}