首页 > 解决方案 > 如何在 WSL 环境中使用 better_errors 启动编辑器

问题描述

better_errors在 WSL 环境中使用 gem。

当我使用 Mac 时,我可以通过单击错误页面的文件路径来打开一个文件,如下所示。 在此处输入图像描述

我在config/environments/development.rb.

BetterErrors.editor='x-mine://open?file=%{file}&line=%{line}' if defined?(BetterErrors)

链接 URL 似乎已正确创建。

x-mine://open?file=%2Fhome%2Fironsand%2Fdev%2Fmyapp%2Fapp%2Fcontrollers%2Fcompanies_controller.rb&line=12`

如何x-mine:在 Windows 中打开以开头的 URL?

标签: ruby-on-railsrubywindowsrubymine

解决方案


从 Microsoft 文档本身,您必须破解系统注册表。

您需要进行如下设置:

HKEY_CLASSES_ROOT
   x-mine
      (Default) = "URL:RubyMine Protocol"
      URL Protocol = ""
      shell
         open
            command
               (Default) = "C:\Program Files\IntelliJ\mine.exe" "%1"

(您可能需要更改路径以使其指向安装 RubyMine 的实际路径)。

有关更多详细信息,请参阅https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85)?redirectedfrom=MSDN


推荐阅读