Bug Report T293675
Visible to All Users

Templates - The 'If' template should be expanded to a single line if statement

created 9 years ago (modified 9 years ago)

I found something really horrible when coding in VB.NET with CodeRush enabled. CodeRush is doing autocomplete on keyword If. If you write "If" and space, CodeRush will create whole If…Then…End If block. In countless places in my code, I am using single line If statement, like:

Visual Basic
If x <= 5 Then Return x

CodeRush is ruining all these attempts and every time creates full block, which must be manually corrected.
Please remove this functionality or at least give option to disable it.

Visual Basic
REM CodeRushed: If x <= 5 Then Return x End If
Comments (1)
DevExpress Support Team 9 years ago

    Thanks for pointing out this issue. The behavior you described is the result of applying the 'if' CodeRush template. We agree that a single line expansion will be more useful for this template and will correct it in the next update. In the meantime, you can make these changes yourself by performing these steps:

    1. From the CodeRush menu, select "Options…".
    2. Set the Language combo on the lower-left of the Options dialog to Visual Basic.
    3. In the tree view on the left, navigate to the "Editor\Code Templates" folder.
    4. Select the "Templates" options page.
    5. In the tree view on the left side of this page, select the "Program Blocks\If blocks\if" item.
    6. Set the expansion to this value: If «Caret»«Field(Expression)»«BlockAnchor» Then.
    7. Click the "OK" button to save changes.

    Answers approved by DevExpress Support

    created 9 years ago (modified 9 years ago)

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.