IntelliJ IDEA
 
Get IntelliJ IDEA

Surround code fragments

Last modified: 20 December 2024

IntelliJ IDEA provides standard templates for surrounding code fragments with various constructs based on the language of the source code. This includes if...else conditional statements, do...while and for loops, combinations of try...catch...finally, XML tags, folding regions, and other constructs.

You can edit code templates that are used in the surround statements. In the Settings dialog (CtrlAlt0S) , go to Editor | File and Code Templates.

For example, you can configure final modifier, name or even a type of the exception for the try...catch conditional statement.

Code template settings

This feature applies to the following languages (contexts):