Rubymine url scheme app (OSX) for you :)
已回答
Hello all,
I made a very basic applescript app that registers the rubymine:// url scheme.
Make sure you use the Rubymine Beta 5 or higher.
Update your rubymine command-line-launcher by going to Tools -> Create Command-line Launcher
The full url should be in the form of : rubymine://open?url=file://FULL_LOCAL_PATH_TO_FILE&line=LINE_NUMBER
I would advice to use BetterErrors (which kicks ass !) available here : https://github.com/charliesome/better_errors
Just put gem "better_errors" in your Gemfile
Then in your development.rb puts
BetterErrors.editor='rubymine://open?url=file://%{file}&line=%{line}'
You should now be able to click the error urls and rubymine will jump to it for you :)
Enjoy !
Gerard.
Attachment(s):
RubyMine Url Handler.zip
请先登录再写评论。
Thanks, great script. I am using RubyMine 4.5 which doesn't seem to accept the file:line syntax, as such the script did not work for me in it's current form. When no line is specified, e.g. 'rubymine://open?url=file://%{file}', it would still try to open '{file}:' instead of '{file}'. I have added the following to fix that:
set file_with_line_number to MyFile
if myLine is not "" then
set file_with_line_number to file_with_line_number & ":" & myLine
end if
I actually have no idea from which version the 'mine' shell script started to support the line number. Did you try to update the shell command ?
version 5 will be out soon though if you don't want to use EAP or beta :)
Thanks for sharing that piece, might bu usefull for other people as well.
Looks like the generate scripts supports: mine <file> -l <line>, so I have updated the script accordingly. Rubymine seems flaky however opening at the proper line, but that's minor: getting the proper to open from url is already super useful and more than sufficient (for me at least). Thanks again!
Hi Gerard,
thanks for this input. I'm trying to get it to work but I've no clue what to do with the attached zip file.
When I double click it, nothing seems to happen.
Thanks!
That is correct :)
You just need to have the app in your applications folder (or anywhere actually)
Now whenever you click on a url that starts with : rubymine:// it will open it for you in rubymine.
So if you are having a ruby / rails project and for example use better errors you can tell better errors to generate the rubymine:// links.
In my original post you can see how to enable that.
Let me know if this works for you :D
Gerard.
just an FYI...I actually had to put the RubyMine Url Handler.app file in my applications folder. I suppose if you want to have it in a different directoy, you can update your path vars.
Thanks Gerard for this apple script!
Thanks for your answer. I moved it to the application folder. When I click the link, I can see it popping up and closing in the OS X taskbar but then nothing happens...
To be more precise:
- At first, I had v5EAP and v4.5 coexisting and, in this config, It opened v4.5
- Then I upgraded to the official v5 and trashed the v4.5. Since then, it nothing opens anymore.
Any clue what could be wrong? I thought the name of the RubyMine App but when I look at your script, it seems to be ok...
Thx.
Your old command line launcher might be pointing to RubyMine 4.5, which doesn't exist anymore. Try from RubyMine 5 to do "Tools > Create Command Line Launcher" and override the existing one. Hopefully that works.
Tried it but doesn't change... Thx.
What about Linux? What url/path should I use?
Is this the url that we should use verbatim to create the command-line launcher?
rubymine://open?url=file://FULL_LOCAL_PATH_TO_FILE&line=LINE_NUMBER
I'm using RubyMine 5 but it's not working.
Next RubyMine version is supporting custom protocol handler with x-mine scheme. Should we add rubymine scheme or x-mine:// is also ok for you?
I've create simple script that opens URL in format rubymine://open?url=file://%{file}&line=%{line} in RubyMine
Put it somewhere in your PATH and name it eg mine-open.
To handle rubymine:// protocol in KDE you shoud create file ~/.kde/share/kde4/services/rubymine.protocol
Look at http://askubuntu.com/questions/62585/how-do-i-set-a-new-xdg-open-setting how to do it in other desktop environments.
mine is ok for me!
Is it supported in the last EAP release? (5.4)
Yes, x-mine protocol from rubymine_heaven gem is supported in 5.4
OK, it finally works. Thanks!
Just FYI, I didn't use "Rubymine heaven". I just did what Gerard said to do and adapted the sentence in development.rb:
BetterErrors.editor='x-mine://open?file=%{file}&line=%{line}' if defined? BetterErrors
Works like a charm. Thanks again!
Here for Ubuntu
https://gist.github.com/hiddenfile/1e04fbb805f6d711bd5a
Here for Ubuntu 18.04 and Gnome: https://gist.github.com/c80609a/752e566093b1489bd3aef0e56ee0426c