Ticket DS5705
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Allow users to configure default code line spacing options

Allow users to configure default code line spacing options

created 19 years ago

This request applies to Refactor! Pro as much as it applies to CodeRush, so I will post the same suggestion under that product.
When performing operations such as Move To Region, that moves code around in the file, or using Refactor! Pro to extract methods and other code modifying tools, it would be nice to specify a default line spacing between items. Currently code is moved or generated and sometimes there is one blank line separating the new item from the items around it, while other times ther are no blank lines between the items and everything is scrunched together.
This results in the code getting very messy after a while.
It would help maintain code cleanliness and organization if the user could define a few simple spacing rules, indicating their preferences for the number of lines separating items.
I know that each developer would have their own ideas about how this should be handled and I assume that a survey of various developer coding habbits and code organization techniques would be required to implement this properly. I will post my personal preferences here as something to start with.
Personally, I prefer no blank lines between member variables, one blank line between #Region definitions, and two blank lines surrounding methods, properties, and classes. The example class below shows a basic example o this formatting.
''' -----------------------------------------------------------------------------
''' Project      : Company.Project.System.Namespace
''' Class      : Project.System.Namespace.MyClass
''' -----------------------------------------------------------------------------
''' <summary>
''' Provides generic functionality for demonstration purposes.
''' </summary>
''' <remarks>
''' This class is created as an example and does not do any real work.
''' </remarks>
''' <history>
'''      [user123]     3/23/2006     Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class MyClass
#Region "Member Variables"
     Private _Var1 As Integer
     Private _Var2 As Integer
#End Region
#Region "Public Properties"
     ''' -----------------------------------------------------------------------------
     ''' <summary>
     ''' Gets or sets a value.
     ''' </summary>
     ''' <value>The value</value>
     ''' <remarks>
     ''' </remarks>
     ''' <history>
     '''      [user123]     3/23/2006     Created
     ''' </history>
     ''' -----------------------------------------------------------------------------
     Public Property Var1 As Integer
          Get
               Return _Var1
          End Get
          Set(ByVal Value As Integer)
               _Var1 = Value
          End Set
     End Property

''' -----------------------------------------------------------------------------
     ''' <summary>
     ''' Gets or sets a value.
     ''' </summary>
     ''' <value>The value</value>
     ''' <remarks>
     ''' </remarks>
     ''' <history>
     '''      [user123]     3/23/2006     Created
     ''' </history>
     ''' -----------------------------------------------------------------------------
     Public Property Var2 As Integer
          Get
               Return _Var2
          End Get
          Set(ByVal Value As Integer)
               _Var2 = Value
          End Set
     End Property

#End Region
End Class
Proposed Solution:

  1. Create a section in the configuration, that allows users to set their default preferences for spacing.
  2. Modify functionality in CodeRush and Refactor! Pro which moves/modifies code to ensure that the spacing rules are followed.
Comments (2)

    I noticed that there were a couple of updates today, to the following issue:
    http://www.devexpress.com/Support/Center/p/S19229.aspx
    The updates were a couple of "SEE ALSO" references.
    I know that this issue has been marked as a duplicate, but it does contain a fairly verbose, distinct perspective on code formatting. I am wondering if you guys could update S19229, to reference this issue as well.
    Thanks!

    Serge (DevExpress Support) 16 years ago

      Sure, Todd … thank you for the note!
      Regards,
      Serge

      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.