After the launch.json
file is generated in Run menu -> Add configuration
-> Ruby LSP debug client you could check if the Ruby LSP extension is set up correctly:
Open an .rb file, and you should see a {} Ruby
icon on your status bar, where you can see if your Ruby LSP server is running and if the correct version of Ruby is displayed there.
Ruby LSP status
After your breakpoints are set, run your app as you usually do,
and when hitting a breakpoint, this
message should show on the VS Code terminal:
等待调试器连接...
一旦出现这种情况,在 < 坚固> 运行和调试 < / 坚固 > 活动菜单中,请确定刚刚添加到 < code > 启动中的选项 < 坚固 > Attach 调试器 坚固 > < 。 json code > 被选中并单击 Play 。 然后您应该能够看到调试环境 。
<强度> 其它方式确保: 强度>
- 调试宝石添加到您的宝石文件中, 且运行 < code> bundle 安装 code> :
group :development, :test do
gem "debug", platforms: %i[ mri windows ]
# Or the one below if you need configuration under WSL also
# gem "debug", platforms: %i[mri mingw x64_mingw windows]
end
-The VSCode rdbg Ruby Debugger is also installed.
Run bundler binstubs debug
for an easy setup. Debugging support with rdbg
-Then go to the Ruby LSP extension -> settings -> search for Ruby Lsp: Ruby Version Manager -> Edit in settings.json ->
add the following:
"rubyLsp.rubyVersionManager": {
"identifier": "rbenv"
}