Search templates, modifiers, and script constraints
When you construct a template for a structural search you are basically writing a script. To simplify your scripting process, RubyMine offers you a list of predefined search templates that you can use as prototypes for your search template.
On how to access the list of the existing search and replace templates, see the structural search and replace section.
A valid search or replacement template represents one of the following supported languages constructs:
Expression, for example
"John" + " " + "Doe"
Statement, or sequence of statements, for example
document.getElementById("demo").innerHTML = "Hello Dolly.";
Class designator, for example
class Engine implements IEngine
Line or block comments, for example
/** Created in RubyMine */
.
In search templates, the following simplifications can be used:
Method body can be omitted.
Short class names (instead of fully qualified names) are used in the templates and constraint fields.
Using
class $Class$
as a template results in finding anonymous classes as well.Templates for comments and documentation comments should contain variables and constructs with correct comment and JSDoc syntax.
Each search or replace template consists of variables $variable_name$
to which you can add a condition (modifier) to narrow your search results. Modifiers depend on a variable in your search template.