Ondrej Kelle that's even worse, because comments are formatted also. I've been wishing for this functionality for years, because the built-in code formatter makes a mess of inline functions and fluid interfaces.
Uwe Raabe there are quite a few pieces of code that the formatter messes up. Initialisation sections, structured consts, hint directives, etc. And there are pieces that are hand-formatters because of readability that I'd like to keep that way.
That's why I always format code when finishing writing methods, like Leif Uneus said: select method code, ctrl+d --> profit. Yes, I format code on "chunks", maybe its clumsy at first, but you get used to it
BTW it would be really cool to use something like a region and tell the formatter "don't touch this"
Being able to make the Code Formatter skip blocks of code would be useful. I only recently started using it. Until this time I always did the formatting myself along the lines of the VCL code. CF is useful indeed, but I really wish it had worked differently. I prefer the way it works in VS - it formats when I hit enter to go to the next line. I can see what it did and also, why should I have to all the time hit Ctrl+D (which BTW doesn't work in IDE Classic key mapping and I'm forced to use the mouse/Alt+E+arrows to select the option - can somebody please confirm this in Seattle and Berlin, so I can file a QR). I have a file with several region markers with comments within and outside the regions and CF completely messes up my beautiful comments. All the regions and comments go to the end of the file (will file this as well). Maybe it would make a good plug-in: Live Code Formatter! Also, one that understood skip markers and/or remember manual negations/corrections of the auto-formatting.
I see an opportunity for a new IDE wizard: Parse the code for a pair of delimiters, save a copy of it, let the formatter do it's work, restore the code, profit ;-)
Have you tried commenting it out temporarily?
ReplyDeleteOndrej Kelle it's quite a few bits spread over the code, so commenting is a bit impractical.
ReplyDeleteWhat is the concrete problem?
ReplyDeleteOndrej Kelle that's even worse, because comments are formatted also. I've been wishing for this functionality for years, because the built-in code formatter makes a mess of inline functions and fluid interfaces.
ReplyDeleteUwe Raabe there are quite a few pieces of code that the formatter messes up. Initialisation sections, structured consts, hint directives, etc. And there are pieces that are hand-formatters because of readability that I'd like to keep that way.
ReplyDeleteDon't know if this helps, but you can keep your line breaks by placing // at the end of the broken line.
ReplyDeleteUwe Raabe that helps partly. Thanks!
ReplyDeleteYou can just not use the built in one and use the Jedi one.
ReplyDeleteWarren Postma how good is the Jedi one with generics? (The GExperts last time wasn't doing well, the Jedi one is too long ago).
ReplyDeleteYou could do the opposite. Select the piece of code you want to format and press ctrl-D.
ReplyDeleteI should try it out. I think the JEDI stuff gets maintained better than GExperts.
ReplyDeleteYou can write your code into a separate include file (MySkip.inc) then include it "{$I MySkip.inc} "into your unit (.pas file).
ReplyDeleteMahdi Safsafi I'd need like a dozen inc files (: And then the Delphi IDE still has inc issues.
ReplyDeleteUse of .inc files to do much more than contain {$IFDEF VER180} type stuff is a fun way to get in all kinds of troubles
ReplyDeleteThat's why I always format code when finishing writing methods, like Leif Uneus said: select method code, ctrl+d --> profit. Yes, I format code on "chunks", maybe its clumsy at first, but you get used to it
ReplyDeleteBTW it would be really cool to use something like a region and tell the formatter "don't touch this"
Being able to make the Code Formatter skip blocks of code would be useful. I only recently started using it. Until this time I always did the formatting myself along the lines of the VCL code. CF is useful indeed, but I really wish it had worked differently. I prefer the way it works in VS - it formats when I hit enter to go to the next line. I can see what it did and also, why should I have to all the time hit Ctrl+D (which BTW doesn't work in IDE Classic key mapping and I'm forced to use the mouse/Alt+E+arrows to select the option - can somebody please confirm this in Seattle and Berlin, so I can file a QR). I have a file with several region markers with comments within and outside the regions and CF completely messes up my beautiful comments. All the regions and comments go to the end of the file (will file this as well).
ReplyDeleteMaybe it would make a good plug-in: Live Code Formatter! Also, one that understood skip markers and/or remember manual negations/corrections of the auto-formatting.
I see an opportunity for a new IDE wizard: Parse the code for a pair of delimiters, save a copy of it, let the formatter do it's work, restore the code, profit ;-)
ReplyDelete