JetBrains Rider
 
Get JetBrains Rider
Get your hands on the new features ahead of the release by joining the Early Access Program for Rider 2025.1! Learn more

Create a live/surround template

Last modified: 25 September 2024

Live/Surround templates can be used for generating code in existing files and (if there is the $SELECTION$ parameter in the template body) for surrounding code fragments with template code, such as try...catch statement.

Each live template is identified by a Shortcut — a short string of characters, for example foreach — that you can type right in the editor to invoke the template.

Live/surround templates can be used for a variety of things, for example for creating classes, DTO’s or skeletons for unit tests.

The body of a live/surround template consists of plain text, which will appear as is, and parameters. The idea is to combine these to maximize efficiency when invoking the template.