[Lazarus] JEDI Code Format

Bernd Kreuss prof7bit at googlemail.com
Sat Oct 23 13:43:37 CEST 2010


On 23.10.2010 12:18, Juha Manninen wrote:

> Did you implement the integration with Lazarus? Nice.

No, this is not my project :-)

I am only an ordinary user.

> I happened to always test it with "too difficult" code. The small example I 
> tried contained generics tests. So, it seems to fail with generics.
> 
> Then one code has this odd use of IFNDEF and ELSE:
> 
> procedure TForm1.PrintPreview1Click(Sender: TObject);
> {$IFNDEF LCL}
> var
>   pf: TPreviewForm;
>   Viewer: ThtmlViewer;
>   Abort: boolean;
> begin
>   Viewer := FrameViewer.ActiveViewer;
>   if Assigned(Viewer) then
>   begin
>     pf := TPreviewForm.CreateIt(Self, Viewer, Abort);
>     try
>       if not Abort then
>         pf.ShowModal;
>     finally
>       pf.Free;
>     end;
>   end;
> {$ELSE}
> begin
> {$ENDIF}
> end;
> 
> I removed ELSE and the extra "begin", and used 2 IFNDEF blocks and then Jedi 
> formatter accepted it.

Maybe (wild guessing) it ignores all IFDEFS and expects that the code is
still grammatically correct or well-formed if you leave them away. Many
people (at least those who have some sense for symmetry) would never
place the $IFDEFs the way it is shown above, maybe this is why it is not
expected by JEDI.

Somebody on this mailinglist here is responsible for maintaining the
Lazarus-JEDI port, I only can't remember his name. He will quickly
port/merge all JEDI changes to Lazarus. IIRC I also filed a bug directly
at the JEDI project.

Bernd




More information about the Lazarus mailing list