[TxMt] Re: Improvements to Objective-C Bundle
Allan Odgaard
throw-away-1 at macromates.com
Thu May 3 03:56:34 UTC 2007
On 3. May 2007, at 05:03, Nithin Reddy wrote:
> Yeah, I knew about that. It doesn't work right. If you have /* */
> comment in the block of code you are commenting then it will won't
> comment out everything after that /* */ comment.
Yeah, /* … */ doesn’t nest, that’s really a language
limitation — for this reason I am using // as the primary comment
character, since that nests nicely.
The default for C and Objective-C was having /* … */ as primary, but
I just changed that. FYI this is a preference in the C bundle.
> Plus, how do you undo it when you want to uncomment the code?
It is a toggle. I.e. just hit ⌘/ again.
> Actually how do others disable parts of the code they are not
> intersted in having executed? I would assume it is a common problem,
> either that, or I am the only one who doesn't trust their own code.
With // as the primary comment character, I think you’ll find ⌘/
nicer, as you can then comment partially commented regions.
But I often make use of #if 0 … #endif to disable code in C. This
also nests nicely and TextMate will render the disabled part as a
comment, and it allows you to use #else, for example:
#if 0
// old code
#else
// new code
#endif
Now you can just change 0 to 01 (or just 1) to switch from the new
code back to the old vice versa.
More information about the textmate
mailing list