JetBrains Rider 2024.1 Help

Template scopes

JetBrains Rider defines a number of scopes where a code template can be available. Scopes help you limit usage of a particular code template to the relevant context.

For example, the predefined live template itar (iterate an array) is available by default in C# 2.0+ statements. It means that this particular scope is defined for this template; you can apply the itar template in the body of a C# statement, but you cannot apply it in the body of a C# class outside of any members or, say, in an XML file.

You can assign several scopes to each template. All template's scopes are shown in the Availability field on the template settings page:

JetBrains Rider: Template scopes

You can edit template scopes in a dialog that opens by clicking the Availability button. For detailed instructions, follow the Create a live/surround template procedure.

The scopes for live templates and surround templates are defined by file type and allowed location. The scopes for file templates are defined by project type.

Last modified: 11 February 2024