Code formatting: use blocks with single line statement and comments

2 posts, 0 answers
  1. miksh
    miksh avatar
    275 posts
    Member since:
    Nov 2006

    Posted 01 Feb 2013 Link to this post

    Hi JustCode team/community,

    I'd like to suggest addressing the code formatting issue for block usage with one or more comment lines and a single line statement.
    Currently, e.g. for if-else options "Always except for single line statement" or "Only if necessary" JC formats from:

    namespace MyNS
    {
        class Class1
        {
            public Class1(int a)
            {
                if (a > 4)
                {
                    a += 4;
                }
     
                if (a > 4)
                {
                    // signle comment line
                    a += 4;
                }
     
                if (a > 5)
                {
                    // comment line 1
                    // comment line 2
                    // comment line 3
                    // comment line 4
                    // comment line 5
                    // comment line 6
                    a += 5;
                }
            }
        }
    }


    to

    namespace MyNS
    {
        class Class1
        {
            public Class1(int a)
            {
                if (a > 4)
                    a += 4;
     
                if (a > 4)
                // signle comment line
                    a += 4;
     
                if (a > 5)
                // comment line 1
                // comment line 2
                // comment line 3
                // comment line 4
                // comment line 5
                // comment line 6
                    a += 5;
            }
        }
    }


    The desired results is below, i.e. treat the comment line(s) as a statement line:

    namespace MyNS
    {
        class Class1
        {
            public Class1(int a)
            {
                if (a > 4)
                    a += 4;
     
                if (a > 4)
                {
                    // signle comment line
                    a += 4;
                }
     
                if (a > 5)
                {
                    // comment line 1
                    // comment line 2
                    // comment line 3
                    // comment line 4
                    // comment line 5
                    // comment line 6
                    a += 5;
                }
            }
        }
    }

  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 04 Feb 2013 Link to this post

    Hi,

     Thanks for the suggestion.
    We will discuss it within the team and reconsider its implementation.
    Furthermore, you can post a feature request at our feedback portal and spread the idea among the community.
    Thank you.

    Greetings,
    Zdravko
    the Telerik team
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
  3. DevCraft banner
Back to Top