Anyone got the Delphi 2010 code formatter to work with anonymous methods?
Posted by jpluimers on 2009/12/24
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?
(You can also react on my Stackoverflow question here, I will update the blog with the relevant answers).
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






Leave a comment