Contexts are widely used in CodeRush for distinguishing states. The Context can be specified in the following CodeRush features.
- Templates — you can setup a template to expand only in certain conditions.
- Shortcuts — you can setup a command to execute only in certain conditions.
The Context is defined with one or several Context Providers combined in a complex expression with the following operators (ordered by priority).
|1||( )||Grouping brackets||([InClass] || [InStruct]) && [IsWPF]|
|3||&&||Logical AND||[InCodeBlock] && [OnEmptyLine]|
|4||||||Logical OR||[InInterface] || [InMethod] || [InProperty]|
The Context Providers are separated by the following groups. Refer to the corresponding topic to learn about the Context Providers which belong to the group.