New Contexts in CodeRush 11.1

An noted in previous posts, contexts are one of the corner stones of the DXCore, that help make your user experience as natural as possible. More contexts allow features a finer granularity with which to test if circumstances should allow them to function.

For example: Templates intended to produce member code, should only be allowed to expand if the caret is within a type and also is not within another member. The p?Type? template is a good example of this. When activated from within a type (rather than from within a member), it produces a property of the correct type. Outside of this situation, it produces nothing.

CodeRush 11.1 adds 4 additional contexts which will return if the current type has any of each of the 4 named items within it.

  • HasConstructors
  • HasFields
  • HasMethods
  • HasProperties

These contexts can be found in the Editor\Code node within any context picker.

As ever, each of these contexts can have any one of 3 states

  • Tick – I require tis context to be explicitly true in order for the specified functionality to be considered valid.
  • Cross - I require this context to be explicitly false in order for the specified functionality to be considered valid.
  • Blank – The value of this context is not important to this function. Don’t test it.

Some of these contexts are used by new CodeRush 11.1 functionality, but all are available to be used by you if you feel the need. Consider these as 4 extra tools in your toolbox.

Feel free to contact me if you feel you need contexts beyond those provided out of the box, and I’ll be happy to show you how they are created. You never know… I might even send you a fully functional example. Smile

no comments
No Comments

Please login or register to post comments.