Delphi IDE: Folding and Next Error from the keyboard

I wish one of the CodeGear bloggers would blog about new keystrokes they’re adding to the IDE with each new version. Once I finally managed to dig up the Help for keyboard shortcuts (such as it is), I found some that I never knew about. Put these in some RSS, man!

Better yet: I wish one of the CodeGear bloggers would blog about new keystrokes they’re thinking about adding, before they actually add them, so there’s some sort of comment period. These keystrokes are atrocious! Honestly, Ctrl+Shift+K T? Think about the amount of finger travel on that one, as your left hand has to move from the farthest left it can go (to hold down Ctrl and Shift) to the farthest right it can go (to press T). Seriously, somebody needs to be publicly flogged for that one.

So here are some keystrokes you probably never knew about. Did you know you can (allegedly) control code folding from the keyboard? And that Delphi actually has a keystroke to jump to the next compiler error?

Here are the most important code-folding keystrokes (Expand All, Collapse All, and Toggle Current, the only ones I’ve ever seen anyone actually use):

  • Toggle Current: Ctrl+Shift+K T.
  • Expand All: Ctrl+Shift+K A.
  • Collapse All: They make this one painful; you have to specify what you want to collapse.
    • Collapse all classes: Ctrl+Shift+K C.
    • Collapse all methods: Ctrl+Shift+K M.
    • Collapse namespace/unit: Ctrl+Shift+K N.
    • Collapse nested procedures: Ctrl+Shift+K P.
    • Collapse regions: Ctrl+Shift+K R.

Note that none of the code-folding keystrokes seem to actually do anything at all, but those are the keys you’re supposed to have to hit, according to the documentation.

And here are the keystrokes for jumping to the next compiler error. They’re also rumored to work for Find in Files results, if you use that instead of GExperts Grep. (And I do, on rare occasions, since Delphi’s regular expression support sucks less than GExperts’, as long as you have the Delphi 6 Help files where Delphi’s goofy regex syntax was actually documented.)

  • Next error / next item in Messages window: Alt+F8.
  • Previous error / previous item in Messages window: Alt+F7.

Note that the “next / previous error” keystrokes aren’t actually documented (at least in Delphi 2006); the only way I was able to find out about them was to file an enhancement request, and then read the reason why it was closed. (Although later I did find them included in a list of interesting, and mostly undocumented, Delphi IDE keystrokes.)

The Twister award, for most useful yet most contorted keystroke, would have to go to Ctrl+Shift+K T, if it worked. But these are all pretty lousy. Alt+Function key, for something you would do repetitively? Eww. Couldn’t CodeGear take a page from ReSharper, and make the most-used keystrokes easier to type?

Leave a Reply

Your email address will not be published. Required fields are marked *