如何配置 VS Code Rails 调试器以在从本地运行的虚拟机启动 Rails 时启动?

Dav*_*ave 5 ruby-on-rails vagrant ruby-on-rails-4 visual-studio-code vscode-debugger

I\xe2\x80\x99m 使用适用于 Mac Big Sur 的 VS Code 1.60.2。我的 Rails 4 实例在虚拟机(vagrant 容器)中运行,我想配置 VS Code 调试器。从我的本地终端,我可以使用以下脚本从 shell 启动服务器 \xe2\x80\xa6

\n
#!/bin/sh\n\nssh -t myvirtual.dev "exec bash --login -c 'foreman start -f Procfile.debug'"\n
Run Code Online (Sandbox Code Playgroud)\n

所以在我的 .vscode/launch.json 文件中,我配置了这个

\n
{\n  "configurations": [\n    {\n      "name": "Rails server",\n      "type": "Ruby",\n      "request": "launch",\n      "program": "/opt/scripts/start_web.sh",\n      "args": [\n      ]\n    },\n
Run Code Online (Sandbox Code Playgroud)\n

但是,当我重新启动 vs code 时,单击左侧的 \xe2\x80\x9cRun/Debug\xe2\x80\x9d 图标,然后单击 \xe2\ 旁边的 \xe2\x80\x9cRun\xe2\x80\x9d 图标x80\x9cRails server\xe2\x80\x9d,我在终端 \xe2\x80\xa6 中收到此错误

\n
Uncaught exception: /opt/scripts/start_web.sh:3: syntax error, unexpected tIDENTIFIER, expecting do or '{' or '('\nssh -t myvirtual.dev "exec bash --login -c 'f...\n
Run Code Online (Sandbox Code Playgroud)\n

我的虚拟容器暴露了端口 3000,但不确定还可以做什么来正确配置调试器。

\n