Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 4 comment formatting (line wrapping)

Tags:

It's my opinion that multi-line comments should ideally appear something like this:

/* this is a mult-line comment, which wraps lines at some reasonable length,
 * usually approximately 80 characters. this way, comments are easy to read
 * and, with any half way capable text editor, easy to edit without having
 * to manually reshuffle lines, line breaks, and the comment leader. */

// this is a mult-line comment, which wraps lines at some reasonable length,
// usually approximately 80 characters. this way, comments are easy to read
// and, with any half way capable text editor, easy to edit without having
// to manually reshuffle lines, line breaks, and the comment leader.

/* this is a mult-line comment, which wraps lines at some reasonable length,
   usually approximately 80 characters. this way, comments are easy to read
   and, with any half way capable text editor, easy to edit without having
   to manually reshuffle lines, line breaks, and the comment leader. */

However, XCode has no support for managing comments in this style. You must manually hit return at the right time to wrap comments at a decent width, and then editing them becomes a complete PITA.

Or, you just never hit return and let the editor wrap it at the edge of your editor screen. But if you're like me, your editor is much wider than the ideal word wrapping line length.

Moreover, XCode taunts me by offering a feature to render a wrapping guide at 80 characters in the editor, yet this is purely a visual feature with no mechanics to back it up. This feels like handing a garden shovel to someone used to using a backhoe.

Do I need a reality check here - am I thinking the wrong way - or is XCode extremely lacking in basic paragraph-style comment formatting?

What do seasoned, responsible, professional Objective-C developers do when making substantial comments in their code? Help me see the light here.

Note: for XCode 3, I wrote a hand-rolled script which reformatted text and bound it to a hot key. I haven't figured out how to do this in XCode 4 yet. But how to script XCode 4 is a bit orthogonal to the issue: it smells bad to have to augment an IDE with such basics, my question is about the style and culture expectations of XCode developers.

Thanks for your advice.