Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
I found this but honestly not sure how to install it or whether it applies. Thanks!
Ruby plug-in that you have linked is designed for IntelliJ IDEA Ultimate only, it will not work with PhpStorm. See this answer for more details.
However, it's possible to get the basic syntax highlighting for Ruby files in PhpStorm using the TextMate bundles support plug-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.
Git clone Ruby.tmbundle into some directory.
Add this directory in Settings | TextMate Bundles:
For some reason PhpStorm TextMate Bundles support will not recognize *.rb files as supported by this bundle. To fix this problem open Ruby.tmbundle\Syntaxes\Ruby.plist file in some text editor, find <key>fileTypes</key> section, add <string>rb</string> under <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)
Restart PhpStorm, verify that *.rb is now associated correctly:
Now you get Ruby syntax highlighting in PhpStorm:
If you need full support for both Ruby and PHP (plus much more) in a single IDE, consider using IntelliJ IDEA Ultimate.
Fantastic thank you!!
Wish I'd known about IDEA Ultimate's capabilities before buying PHPStorm and RubyMine separately!
@JackMahoney buying separate products has its benefits, you get new features faster than in IDEA plug-ins and interface is less flooded with unrelated options, see also this answer.
Not to mention, the size/memory footprint of having the ultimate one
@JackMahoney I've bought both too, but I think separate products are much better. I can't imagine that you'd be working on a Ruby and PHP project at the same time.
This doesn't work in windows as a large number of the filenames are invalid in windows systems
@Populus thanks for the pointer, I've updated the answer with your link.
@Populus using the official repo still gives me filename problems on Windows. How did you guys solve this?
@hgcrpd I used Intellij Idea Ultimate.
So in other words this doesn't work in windows because the textmate bundles have invalid windows filenames?
This approach works with RubyMine too (and probably the other JetBrains IDEs). I added the Python bundle to RubyMine.
ok @CrazyCoder any idea how to view python scripts in php storm?
Does anyone else get a white background behind the text? I am using PHPStorm for Mac. My background is grey but the ruby file uses white until it is the selected line.
Thank you! Working almost perfectly on Windows 7 on PhpStorm - had to change my current custom dark theme's gray to #2C2C2C to get consistent bgcolor to match RailsCast theme. @DutGRIFF You have to change TextMate Color Scheme in Settings - Editor - Code Style - TextMate Bundles.
I also added <string>Vagrantfile</string> into Syntaxes\Ruby.plist to get syntax highlighting for Vagrantfiles.
I'm using the Darkula theme. For me, all of the whitespace was bright white and the highlighting was just awful.
@jimbo you need to set the colour scheme under the textmate bundle plugin options. Preferences/Settings > Editor > TextMate Bundles, then you will see there is a listing of colour schemes with ide schemes on the left and textmate on the right, you can match up darcula to use darcula there.
@Sam i've added # -*- mode: ruby -*- (\n<-replace this with a new line) # vi: set ft=ruby : to the top of my vagrantfile which works too.
# -*- mode: ruby -*- (\n<-replace this with a new line) # vi: set ft=ruby :
Works in Webstorm too!
Do you know of a way to get the auto-indent to work as well? (i.e. in python language if you use CMD+A to select all, then CMD + Option + L, it auto indents the code) It doesn't work with the Ruby files.
@CrazyCoder Ruby.tmbundler fixed the rb extension issue, editing the Syntaxes/Ruby.plist is not required anymore. Could you update your answer with this information?
For those of you on 2016.3, you can map themes to Darcula right in the TextMate Bundles screen. It's no longer in "Editor".
CrazyCoder's git repo doesn't work in windows systems, as a large number of the filenames are invalid in Windows.
I have, however, found the official repo for ruby for textmate:
Using Windows, worked for me, thanks! File -> Settings -> Textmate Bundles. Click + (top right), select local clone of ruby.tmbundle. Click OK. Didn't even need to restart PHPStorm.
I actually copied over my PhpStorm theme to RubyMine with no issue, so it should go both ways.
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/