Author Topic: Indent on comment with indent lines afterwards?  (Read 3388 times)

Offline AraspiK

  • Single posting newcomer
  • *
  • Posts: 2
Indent on comment with indent lines afterwards?
« on: April 02, 2017, 10:08:31 pm »
* MISLEADING SUBJECT * I had no idea how to put this in words
Sometimes my code goes:
Code
// LOCAL INCLUDES
    #include "..."
// SYSTEM INCLUDES
    #include <...>
Or:
Code
class myClass {
    string var1
    // Lambdas
        std::function<void(void)> func

    public:
        ...
}
How can I tell C::B to fold the indent stuff after a comment and keep such formatting? VSCode supports this, if anybody wants to know.
PS: My code: https://github.com/AravK/KGB2

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indent on comment with indent lines afterwards?
« Reply #1 on: April 03, 2017, 02:02:15 am »
Can you please try to explain your problem with more details. I have no idea what you're trying and what it doesn't work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AraspiK

  • Single posting newcomer
  • *
  • Posts: 2
Re: Indent on comment with indent lines afterwards?
« Reply #2 on: April 03, 2017, 05:51:39 pm »
I want
Code
// foo
    string bar;
    foobar fooBar;
to become
Code
// foo ... 

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Indent on comment with indent lines afterwards?
« Reply #3 on: April 03, 2017, 06:05:54 pm »
I want
Code
// foo
    string bar;
    foobar fooBar;
to become
Code
// foo ... 
I still don't understand what's the problem you have. Can you give more details? What is the current/exprect way, what is the steps to reproduce this error.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blauzahn

  • Almost regular
  • **
  • Posts: 153
Re: Indent on comment with indent lines afterwards?
« Reply #4 on: April 03, 2017, 06:39:44 pm »
sounds like he wants code-regions like in C# where you can fold away all the crappy stuff under the rug.

Whether that is a good technique is IMHO debatable. If you feel it being necessary when
dealing with big classes it may be time to think about splitting it because it probably plays
more than one role.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Indent on comment with indent lines afterwards?
« Reply #5 on: April 03, 2017, 11:00:39 pm »
You can add
Code
//{
This can be folded
//}

to your comments and you will be able to fold this

for example:
Code
// LOCAL INCLUDES
//{
    #include "..."
//}
// SYSTEM INCLUDES
//{
    #include <...>
//}

There is now easy way to make this generic... How should a parser know where to start folding and where to stop?
« Last Edit: April 03, 2017, 11:02:35 pm by BlueHazzard »