Hi Allen,
Some common commenting techniques used with manually managed code formatting (i.e. manual linebreaks) are below.
I'm just putting them out there in case you're not already thinking about them (but you probably are!).
Basically, we probably wouldn't want these things to become more difficult once auto-wrapping is introduced...
This is a common construct:
| someFlags = 0
| SOME_FLAG_1
| SOME_FLAG_2
| SOME_FLAG_3
;
|
Then if you want to turn off SOME_FLAG_2, pretty easy:
| someFlags = 0
| SOME_FLAG_1
//| SOME_FLAG_2
| SOME_FLAG_3
;
|
Another one is:
Then one wants to quickly remove the conditional:
| //if(something)
{
stuff;
}
|
I guess one simple way of handling those cases is that if somebody inserts a single-line comment somewhere while in auto-wrap mode, you'll also have to insert manual/appropriate linebreaks into the "real" non-autowrapped sourcecode.
The other point here is that some people may prefer bitflags be aggressively wrapped each onto their own line (like shown above) for easy commenting-out, and they may prefer that braces are aggressively wrapped to their own line (like above for the if statement) for similar reasons of easier commenting-out. I'm pointing all of this out because it could be easy to write off things like brace-wrapping rules and bitflag wrapping rules as mere cosmetic preference, but they can actually serve an important functional purpose in making certain editing tasks (commenting/uncommenting in this case) easier/faster.
Then again, down the line you may want to have a
Comment out this "thing" under the cursor feature that you can bind to a key, so say:
| enum
{
SomeThingOne, SomeThingTwo, SomeThingThree
};
|
And my cursor is on top of "SomeThingTwo". I can hit my "comment out this thing" hotkey and i'll end up with:
| enum
{
SomeThingOne, /*SomeThingTwo*/, SomeThingThree
};
|
This gets a bit tricky, though. What if you have:
| if(something && another_thing && one_more_thing)
{
stuff;
}
|
And your cursor is on top of another_thing. Well, that could mean:
| if(something && /*another_thing*/ && one_more_thing)
{
stuff;
}
|
Or:
| //if(something && another_thing && one_more_thing)
{
stuff;
}
|
So perhaps the "comment out this thing" key could cycle between all the possible states... in this case:
| if(something && /*another_thing*/ && one_more_thing)
|
And:
| //if(something && another_thing && one_more_thing)
|
And back to:
| if(something && another_thing && one_more_thing)
|
The "comment out this thing" feature perhaps better addresses the root issue here, rather than using code formatting rules as a workaround of sorts as shown at the beginning of this post. But I think that probably has to be experimented with a bit more to know for sure.