[Lazarus] code format selection only

Rik van Kekem rik at graficalc.nl
Mon Nov 30 11:27:32 CET 2015


Graeme Geldenhuys wrote:
> As far as I understand the code formatter included with Lazarus is the
> Jedi Code Formatter. Does anybody know if it supports formatting only a
> selection (eg: the body of a method) - or does it always require whole
> unit formatting?
As far as I could see in the source the Jedi Code Formatter takes the 
complete source-file (from the editor). I also noticed it's kinda fussy 
about incomplete code. It will not reformat incorrect code. De Code 
Formatter in Delphi CAN format incomplete code. So formatting a part of 
source-code would be difficult because it's incomplete. You can also see 
this if you only copy your intended method to an empty unit and try 
formatting it. It will not work.

In the past I looked for an option to disable JCF for part of the 
source-code but I couldn't find anything. That would be more useful to 
me than formatting part of the code. Sometimes you don't follow "the 
rules" on purpose because it's more clear but the JCF mangles it up. 
Disabling JCF for just that part would be useful.

Grtz,
Rik (rvk)




More information about the Lazarus mailing list