Home > Code Generation, Troubleshooting > Resolving code template conflicts

Resolving code template conflicts

September 30th, 2012

Sometimes, you may find unexpected code template expansions when you typing code. This may happen when the template expansion key is bound to the Space Bar. Because this is a key used very often and there are tens of thousands of code templates; a complex contexts system, something may go wrong, especially if you prefer one or two key identifier names which may correspond to existing template abbreviations.

There are several approaches to resolve the unexpected template expansions:

  • Change the Expansion Key to Tab instead of Space Bar (use FrictionFree settings scheme) on the Shortcuts option page. Bear in mind that, in this case, you will lose numerous automatic and essential code template expansions like “if”, “while”, “for”, “switch”, etc. These code blocks are automatically completed with parens and braces with the code templates expanded by the Space Bar.
  • Enable the What Happened (Feature UI) window which will alert you on each code template expansion. This will allow you to choose what templates must be always available and what templates must never be expanded (disabled).
  • Once a code template is expanded, open the Templates option page. The last expanded template will be selected. Here, you can:
    • Delete the code template if you don’t need it;
    • Change the trigger key to Secondary key (e.g., Shift+Space);
    • Disable the entire template category by unchecking the folder where a template resides.
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Oct/02/2012
ID: C195

Similar Posts: