Skip to main content

Context Providers

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).

Priority Operator Description Example
1 ( ) Grouping brackets ([InClass] || [InStruct]) && [IsWPF]
2 ! Logical NOT ![OnEmptyLine]
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.