JavaScript templates
Method calls
The simplest template to search for method calls is $Instance$.$MethodCall$($Arguments$)
.
![Search template for method calls Search template for method calls](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_find_method_call_template.png)
The Find tool window shows the detected method calls.
![Search results in the Find tool window Search results in the Find tool window](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_find_method_call_results.png)
If you need to locate a method call with the specific number of arguments, place the caret at the $Arguments$
variable and configure the Count filter for it.
![Search template for method call with a count filter Search template for method call with a count filter](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_find_method_call_template_count.png)
The list of search results in the Find tool window shrinks.
To navigate to the method call in the source code, double-click it in the Find tool window. GoLand opens the corresponding file in the editor and positions the caret at the method call.
![Structural search: jump to source Structural search: jump to source](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_jump_to_source.png)
The source code with the detected method calls are also shown in the right-hand pane of the Find tool window.
JavaScript and Typescript classes
If you have a JavaScript or Typescript class MyClass
:
Then the simplest template to search for it is class $name$ {}
.
![Structural search for classes Structural search for classes](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_find_class_results.png)
Implementations of interfaces
If you have a JavaScript or Typescript interface MyInterface
and a class Implementation
that implements it:
Then the simplest template to search for the implementation is class $Class$ implements $SomeInterface$ {}
Descendant classes
If you have a JavaScript or Typescript class Parent
and a class Descendant
that extends it:
Then the simplest template to search for Descendant
is class $Class$ extends $AnotherClass$ {}
Statements
The simplest template to search for if statements is if($var$){$code$}
As a result, the detected occurrences will be shown in the Find tool window, double-click the one you are interested in to navigate to the source code. GoLand opens the corresponding file in the editor and positions the caret at the statement.
![Structural search if statement Structural search if statement](https://resources.jetbrains.com/help/img/idea/2023.3/ws_structural_search_if_statement.png)
Comments and string literals
The simplest template to find comments or literals containing SomethingWeWantToFind
is: $SomethingWeWantToFind$
or "$SomethingWeWantToFind$"
. To find comments/strings containing some particular words (say, SomethingWeWantToFind as a word), this should be specified as a text constraint.
![Search for string literal Search for string literal](https://resources.jetbrains.com/help/img/idea/2023.3/ws_ssr_examples_find_string.png)