views:

178

answers:

1

With the default settings, the Delphi 2010 code formatter folds anonymous methods on one line.

Is there anyone who has found settings to circumvent this?

Original code:

procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
  AppendMemberResults(StringBuilder,
    function(Member: TGeneratableInUnit): IStringListWrapper
    begin
      Result := Member.FinalizationText;
    end
  );
end;

procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);

Formatted code:

procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
  AppendMemberResults(StringBuilder, function(Member: TGeneratableInUnit): IStringListWrapper begin Result := Member.FinalizationText; end);
end;

procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);

As you can see, the anonymous method is being formatted to one line.

I feel I'm missing some kind of setting here...

--jeroen

+6  A: 

It's logged as a formatter bug in Quality Central: 77547.

frogb
Thx. I just looked at http://qc.embarcadero.com/wc/qcmain.aspx?d=77547 can you add my formatting issue to it? As I think they differ a tiny bit; it would be a shame if they fixed only half :-)
Jeroen Pluimers
I am not one of the high priests who can edit QC items, I am afraid.
frogb
Anybody can add comments to a QC report, including either one of you.
Rob Kennedy
But I have been told off in the past for putting interesting stuff into comments, because apparently they all get stripped when (if) the report gets promoted to the internal database for action. I have no idea how true that is, but it is why I did not suggest adding a comment.
frogb
I'm sure you haven't been "told off." That would suggest somebody was actually *angry* with you and yelling to put you in your place. You might have been *admonished*. Anyway, given the choice between providing information in the comments and providing no information at all, go for the comments.
Rob Kennedy