views:

124

answers:

2

Is there any way the Format Source (CTRL+D) command applies only to the selected text (or the current method the caret is in)?

I'm asking this because the formatter is quite buggy (ok, actually useless) when anonymous functions are used anywhere in the module to be formatted.

A: 

I'm using Delphi 2010 with Update 4 and 5 installed, and source code formatter works as expected; if a piece of code is selected, then running Source Format (Ctrl+D) just formats the selected part, and if no code is selected, then running formatter formats the current unit.

Also, it works fine for me in formatting anonymous methods, but I checked it only with simple ones, and I am not sure if it works properly on more complicated anonymous methods or not.

vcldeveloper
Interesting, I have the same version but selection does not affect the formatting at all. It just formats all file.
utku_karatas
@Charles: What is the major bug? I wasn't able to produce any bug when I used your sample external function declaration!
vcldeveloper
Formatting code with an external function – does funny things to your file
Charles Faiga
+3  A: 

I have stopped using the code formatter because of all the bugs

A better option is the Jedi code Formater.

Here are some other alternatives

Charles Faiga
+1 for mentioning alternative code formatters.
Jeroen Pluimers
Thanks. I went with the experimental GExperts by twm(www.dummzeuch.de).
utku_karatas