This is a migrated thread and some comments may be shown as answers.

[Solved] Code formatting: use blocks with single line statement and comments

1 Answer 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
miksh
Top achievements
Rank 1
Iron
miksh asked on 01 Feb 2013, 09:00 PM
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;
            }
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 04 Feb 2013, 12:11 PM
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.
Tags
General Discussions
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Zdravko
Telerik team
Share this question
or