Navigation Inside RubyMine
What do you imagine first when you think of a mine? Probably a hole going under ground where everything is pitch-dark and it's difficult to find your way around... But we, ruby "miners", cannot afford to wander the depths of our projects' code with a shimmering torch. Time is worth more than rubies!
Efficient project code navigation is critical, and a key area we focus on in creating the RubyMine IDE. However, since no two projects are alike, and each developer has their own habits and practices, we have designed different sets of navigation commands to suit both keyboard addicts and mouse maniacs. Choose what's right for you, but consider checking the other options, too.
Read on for a quick overview of RubyMine project navigation commands.
Rails Project Views and Navigation Options
It is no secret why many of us use Ruby today — Ruby on Rails! Indeed, this framework does a great job of simplifying web-oriented development. And RubyMine is prepared for the Rails.
First of all, for Ruby on Rails projects RubyMine offers a special Rails Project View, which logically and clearly groups the elements of a Rails project such as Controllers, Models, Helpers, Views, etc.
Click through the nodes of the project view to see what is where in the structure. Also, see the short demo, "Open your 1st Ruby on Rails project" (30 sec).
Model Diagram — Bird's Eye View of Your Rails Project
Sometimes it's useful to step back and take a look at your project as a whole. It can provide a broader picture as things get more complex. For this purpose, RubyMine offers the Model Dependency Diagram, which shows all project models and their associations.
The diagram uses standard UML notation and serves as a map for quick navigation to project files:
You can print the diagram or export it as necessary.
Also check the "Model Dependency Diagram" demo (1 min 15 sec).
Navigate to Rails
No matter what is currently opened in the IDE, you can go to one of the related project entities by using the Navigate to Rails feature or its shortcut, Alt+Shift+N. So, for example, you can jump from a Model to its Controller, from a Controller to its Test, Helper of View, etc. It works everywhere, including the model diagram.
Action <-> View
As you are editing your code, RubyMine provides visual notifications which also serve as navigation options. Action methods in controller have a "gutter" icon pointing to the associated view file. View files also have an icon that opens the associated action when clicked.
If you click the 'view' icon for an action that has no view yet, RubyMine will offer to create the appropriate view file automatically.
Ruby Code Navigation
There are some generic features, not Rails-specific, that also come useful and help increase your productivity.
Go To Class / File
When working on your own project, you often know which file or class you want to open and edit. The fastest way to do this is to use Go to Class... (Ctrl+N) or Go to File... (Ctrl+Shift+N).
Both offer very comprehensive functionality. For instance, you can use CamelHumps to save some key presses, or wildcards for file/path matching (see the screenshots above).
The Navigation bar, which is located over the editor tabs, shows the path to the currently edited file. It also allows you to navigate within the folder structure and open files for editing. Just press Alt+Home to access the bar using only your keyabord or, alternatively, use your mouse:
Overridden <-> Overriding
Quickly navigate through class hierarchy using the overridden/overriding gutter navigation icons:
This is by no means an exhaustive list of navigation options available in RubyMine, but then again, there are enough of them to write a whole book. Use the following short list of other "go to..." things that are worth trying and remembering. They are really the things that you'll need daily, if not hourly.
- Go to symbol
- Go to declaration
- Go to super method
- Quick definition lookup
- Go to line
- Context info
- Parameter info
- Go to next/previous method
Just open the "Go to" menu and you'll see the whole list.
RubyMine is a dedicated Ruby IDE with great Ruby on Rails support, built with developer productivity in mind.
RubyMine is currently in Early Access (EAP), with 1.0 release planned for March 2009. If you are interested to know what we plan to include in RubyMine 1.0 — check the development roadmap.
You can download the latest RubyMine build and find your way through the Ruby code.