Monday, May 21, 2012

IDE Tips and Tricks

Here are a few tricks for using the Real Studio IDE more efficiently:

Finding all declarations of a method
Let's assume you have a several methods named "DoSomething" and they are called all over your code, hundreds of times. To find the methods' code you could enter it into the Finder box or right-click on the name where it's called and use the Find command from the contextual menu. But that will reveal not only the method declarations but also all the calls to it. How do you find just the declarations then?

Note that even method declarations in the IDE are internally known with their "proper" RbScript-like code wrapper, e.g.:

  Sub DoSomething (action as Integer)

And you can search these entire lines.

So, to find just the methods, you search for "Sub DoSomething", or even shorter " DoSomething" (note the blank at the beginning), assuming DoSomething is a class member method which is usally referenced with a object name and a ".".

Finding the one declaration of a method
You can quickly jump to a method or property declaration if you hold down the Command (Windows: Control) key and then double click on its name in the code.

Preserving previous Find results when performing another search
Normally, when you perform a Find operation, the results will always be shown in the same Tab, overwriting the previous results.

To prevent that, simply turn the results Tab into its own window, by either right-clicking on the Tab and choosing "Open In New Window", or by dragging the Tab out of the main window. That will open a new window showing just the results. These results won't get replaced when you perform the next search operation.

Remembering breakpoints
Do you use breakpoints often, would you like to keep them when you save and re-open your project? Note that only the XML and RBP project file formats preserve breakpoints, the VCP format doesn't.

If you don't want to switch to the other formats but like your code to stop in certain places, place the statement "break" into the code instead of using a breakpoint. The break statement has the same effect (though you can't simply turn it off during a debugging run like you can with a breakpoint).

2 comments:

anic297 said...

The command-double-click shortcut for the “Go to ” is great! Thanks for having shared it!

Alwaysbusy said...

Preserving previous Find results when performing another search:

OMG! Been using RealStudio for years now and cursed myself and RS a kazillion times because I had to do several different searches and lost my previous search.

Top Tip!