php 是否可以在 PHPStorm 中突出显示 Ruby 语法?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16451359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:09:42  来源:igfitidea点击:

Is it possible to get Ruby syntax highlighting in PHPStorm?

phprubyphpstorm

提问by jcroll

I found thisbut honestly not sure how to install it or whether it applies. Thanks!

我发现了这个,但老实说不知道如何安装它或它是否适用。谢谢!

回答by CrazyCoder

Ruby plug-in that you have linked is designed for IntelliJ IDEA Ultimate only, it will not work with PhpStorm. See this answerfor more details.

您链接的 Ruby 插件仅适用于 IntelliJ IDEA Ultimate,它不适用于 PhpStorm。有关更多详细信息,请参阅此答案

However, it's possible to get the basic syntax highlighting for Ruby files in PhpStorm using the TextMate bundles supportplug-in. It's already included with PhpStorm 6.0.1 and you don't need to install it, just make sure it's enabled in Settings| Plugins.

但是,可以使用TextMate 包支持插件在 PhpStorm 中获得 Ruby 文件的基本语法突出显示。它已经包含在 PhpStorm 6.0.1 中,你不需要安装它,只需确保它在Settings| 中启用。Plugins.

  1. Git clone Ruby.tmbundleinto some directory.

  2. Add this directory in Settings| TextMate Bundles:

  1. Git 将Ruby.tmbundle克隆到某个目录中。

  2. 将此目录添加到Settings| TextMate Bundles

Ruby bundle

红宝石包

For some reason PhpStorm TextMate Bundles support will not recognize *.rbfiles as supported by this bundle. To fix this problem open Ruby.tmbundle\Syntaxes\Ruby.plistfile in some text editor, find <key>fileTypes</key>section, add <string>rb</string>under <array>

出于某种原因,PhpStorm TextMate 捆绑支持将无法识别*.rb此捆绑支持的文件。要解决此问题,请Ruby.tmbundle\Syntaxes\Ruby.plist在某些文本编辑器中打开文件,找到<key>fileTypes</key>部分,在<string>rb</string>下面添加<array>

(the above should be fixed in the latest Ruby bundle version, so the editing the bundle is no longer needed, but if you are adding some other language bundle, it's something you may need to adjust)

(以上应该在最新的 Ruby bundle 版本中得到修复,因此不再需要编辑 bundle,但是如果您要添加一些其他语言的 bundle,则可能需要进行调整)

Restart PhpStorm, verify that *.rbis now associated correctly:

重新启动 PhpStorm,验证*.rb现在是否正确关联:

association

协会

Now you get Ruby syntax highlighting in PhpStorm:

现在您可以在 PhpStorm 中获得 Ruby 语法高亮:

Ruby syntax

Ruby 语法



If you need full support for both Ruby and PHP (plus much more) in a single IDE, consider using IntelliJ IDEA Ultimate.

如果您需要在单个 IDE 中完全支持 Ruby 和 PHP(以及更多),请考虑使用IntelliJ IDEA Ultimate

回答by Populus

CrazyCoder's git repo doesn't work in windows systems, as a large number of the filenames are invalid in Windows.

CrazyCoder 的 git repo 在 Windows 系统中不起作用,因为大量文件名在 Windows 中无效。

I have, however, found the official repo for ruby for textmate:

但是,我为 textmate 找到了 ruby​​ 的官方存储库:

https://github.com/textmate/ruby.tmbundle

https://github.com/textmate/ruby.tmbundle

回答by Adam Patterson

I actually copied over my PhpStorm theme to RubyMine with no issue, so it should go both ways.

我实际上将我的 PhpStorm 主题复制到 RubyMine 没有问题,所以它应该是双向的。

I went as far as to create a TextMate keymap for PhpStorm as well, you can take a look here: http://tentaclecms.com/blog/2013/08/textmate-keymap-for-phpstorm/

我还为 PhpStorm 创建了 TextMate 键盘映射,您可以在这里查看:http: //tentaclecms.com/blog/2013/08/textmate-keymap-for-phpstorm/