やりたいこと
Visual Studio CodeでRailsのデバッグ/ステップ実行がしたい。
発生している問題
https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby
上記拡張機能を使ってVisual Studio Codeでrailsのデバッグ/ステップ実行がしたいと思っており、デバッグ実行自体は成功しているんですが設定したブレイクポイントでストップせずに困っています。
・試した手順
1.Visual Studio CodeのRuby拡張をインストール。
2.Gemfileに下記追加
gem 'ruby-debug-ide' gem 'debase'
3.gemのインストール
bundle install
4.launch.jsonを作成(rdebugの設定は以下になります)
{ "name": "Listen for rdebug-ide", "type": "Ruby", "request": "attach", "cwd": "${workspaceRoot}", "remoteHost": "127.0.0.1", "remotePort": "1234", "remoteWorkspaceRoot": "${workspaceRoot}" }
5.適当なcontrollerにブレイクポイントを設置(下記のputsのところに設置しました)
class HomeController < ApplicationController def index puts 'test' end end
※routes.rb
root 'home#index'
6.rdebugをターミナルから起動
bundle exec rdebug-ide --host 127.0.0.1 --port 1234 --dispatcher-port 26162 -- bin/rails s
※ログ
Fast Debugger (ruby-debug-ide 0.7.0.beta4, debase 0.2.2, file filtering is supported) listens on 127.0.0.1:1234
7.VS Codeのデバッグ画面から、デバッグ構成の「Listen for rdebug-ide」を選んで再生ボタンをクリック。
※ログ
=> Booting Puma => Rails 5.2.0 application starting in development => Run `rails server -h` for more startup options Puma starting in single mode... * Version 3.11.4 (ruby 2.5.1-p57), codename: Love Song * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop
結果、5.の「puts 'test'」に設置したブレイクポイントで止まらず普通に画面が表示されてしまいます。
長くなり申し訳ありませんが、なにかご存知の方おりましたらご教示願います。
補足情報
Ruby v2.5.1p57
Rails v5.2.0

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。