English 中文(简体)
调试 Windows 10 或更大的平台上的 MS 视觉工作室代码编辑器上的 Ruby 程序
原标题:Debugging a Ruby program on a MS Visual Studio Code editor on Windows 10 or greater platform
  • 时间:2024-02-02 19:01:31
  •  标签:
  • ruby

我使用 Windows 10 电脑, 带有 MS 视觉工作室代码, 我试图使用可用的扩展名调试简单的红宝石代码。 曾经有 Ruby Lang 支持和 Peng Lv 调试, 但是它已经取消定价 。 我同时也使用 Ruby 版本, 它大于 3. 2. 2. x 。

他们声称Ruby LSP的延期是一个替代, 但肯定不像常规调试器加插一样有效。 最近有人试图使用 MS Studio 代码来调试Ruby 和 debug 吗? 您如何使用 MS Studio 代码? ( 您推荐的哪个扩展)? 启动的基本步骤是什么? 我尝试了推荐的 Ruby LSP 扩展描述中的发射。 json, 但由于某种原因, 它不适合我 。

提前感谢。

问题回答

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 被选中并单击 Play 。 然后您应该能够看到调试环境 。

<强度> 其它方式确保:

- 调试宝石添加到您的宝石文件中, 且运行 < code> bundle 安装 :

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"
    }




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签