Structural search and replace dialogs
Use these dialogs to find and replace fragments of code that structurally match the suggested search template.
Item | Description | Available in |
---|---|---|
Search template | Use this text area to specify the template based on which PyCharm performs the search process. You can type the template code in the field or click and select the Existing Templates option to see a list of existing templates. | Both |
Match case | Select this checkbox if you want PyCharm to match the case of the code you are searching for. | Both |
File type | Use this option to select a file type for your search. In this case, PyCharm searches only in the specified file types. | Both |
Click this icon to add modifiers for the whole search template. Use to add a new modifier or to remove the existing one. | Both | |
Click this icon to select one of the following options:
| Both | |
Replacement template | Use this text area to specify the template to be substituted. You can type the template code in the field or click and select the Existing Templates option to see a list of existing templates. | Structural Replace |
Click this icon to see the list of your previous searches. | Both | |
Shorten fully qualified names | This option makes sense in case the template text contains fully qualified class names. If the checkbox is selected, PyCharm automatically reduces these names in the template. Otherwise, fully qualified class names are used. | Structural Replace |
Reformat | Check this option, if you want PyCharm to automatically reformat the expanded code fragment according to your code style settings (for more information, refer to the Code Style dialog). If the option is not checked, PyCharm will only indent the whole template according to the position in code at which it is expanded, leaving its formatting as is. | Structural Replace |
Use static imports | Check this option, if you want PyCharm to shorten any references to static elements in the replaced code. PyCharm will insert a static import for those elements. The elements are then referenced by their short name. If there are no references to static elements in the replaced code, the option will be ignored. | Structural Replace |
In | Use this area to specify where PyCharm should search for and replace your code. You can select from the following options:
| Both |
Search target | Use this option to specify the target of your search process which could be the exact match of the template you have specified (Complete match) or just a part of it. The options of the search target depend on the file type you have selected. | Both |
Open in new tab | If this checkbox is selected, the results of the new search display in a new tab in the Find results tool window. Otherwise, the search results update the existing tab. | Both |