It would be nice if Delphi supported code folding for all begin..end blocks and not just certain ones.

It would be nice if Delphi supported code folding for all begin..end blocks and not just certain ones.

+if SomeCondition then
  begin
     // DoStuff
  end
+else
  begin
    // DoSomethingElse
  end;

Comments

  1. There you go. Sure you can use regions but you really shouldn't have to.

    ReplyDelete
  2. I see your point, but I have to say that it is rare that I feel an urge to collapse code blocks within a method.

    I usually factor out into more methods instead, or - in some cases, local procedures or functions.

    if SomeCondition
     then DoStuff
      else DoSomethingElse;

    Divide and conquer.

    ReplyDelete
  3. Well it's a nice to have feature, I guess when a method is too long it's a code smell.

    ReplyDelete
  4. I'm currently attempting to refactor a function that's 223 lines long and has loops nested 3 levels deep and if..else statements 13 levels deep. It would come in handy right about now.

    ReplyDelete
  5. Ouch! Those I can relate to. Start at the deep end and isolate into local functions.

    ReplyDelete
  6. Kenneth Cochran If you have ModelMaker code explorer, Press Shift+Ctrl+X (Extract method), it's very handy.

    ReplyDelete

Post a Comment