Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to navigate to the method declaration of a Ruby on Rails method in Sublime Text?

I am looking for a functionality for easy navigation of source code.

Here is my problem to be specific:
I use Sublime Text, and I often tend to read the method definition of a lot of methods before implementing them, but for that, I need to go to the source code on GitHub and search for that exact location where the method is defined

What I am looking for:
I am looking for a functionality wherein, when I double click on a method, it should open the definition of the method at the same place, preferably in a new tab.

Example:

In Rails, clicking on the method before_filter should open the method definition of before_filter.

This is similar to:

⌘ + mouse-click

functionality in RubyMine. More information here.

I have referred to articles for CTags which do not seem to help.

like image 241
Chirag Avatar asked Sep 28 '22 08:09

Chirag


People also ask

How do I run Ruby program in Sublime Text?

Make sure you're in Ruby mode by clicking on the language selector in the bottom-right corner of the screen. From then on, you can run it right there in Sublime by pressing Tools -> Build, or using the CTRL-B hotkey.

What does it mean when a method ends with in Ruby?

Ruby doesn't treat the ! as a special character at the end of a method name. By convention, methods ending in ! have some sort of side-effect or other issue that the method author is trying to draw attention to.


1 Answers

In Sublime Text 3,

There are two way to do it.

  1. Right click on method or text and you will see "Goto Defination"

Or

  1. Shortcut key is F12
like image 68
Vaibhav Mule Avatar answered Oct 03 '22 03:10

Vaibhav Mule