6

Delphi 2010 Code Formatter: & ldquo; (MyVar as TMyType) .MyMethod & rdqu...

 3 years ago
source link: https://www.codesd.com/item/delphi-2010-code-formatter-myvar-as-tmytype-mymethod-is-divided-into-two-lines.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Delphi 2010 Code Formatter: & ldquo; (MyVar as TMyType) .MyMethod & rdquo; is divided into two lines

advertisements

How to prevent the code formatter from doing this? It seems that it moves casts with "as" always a line up. Is this a bug, or is there any setting in the formatter?

// Before formatting:
procedure TMyFrame.WidthEditChange(Sender: TObject);
begin
  (Properties as TMyProperties).Width := (Sender as TJvSpinEdit).AsInteger;
end;

// After formatting:
procedure TMyFrame.WidthEditChange(Sender: TObject);
begin (Properties as TMyProperties) // <----- I want this untouched
  .Width := (Sender as TJvSpinEdit).AsInteger;
end;

It gets weird:

// Before formatting:
procedure TMyFrame.WidthEditChange(Sender: TObject);
begin
  (Properties as TMyProperties).Width := (Sender as TJvSpinEdit).AsInteger;
  (Properties as TMyProperties).MyMethod;
end;

// After formatting:
procedure TMyFrame.WidthEditChange(Sender: TObject);
begin (Properties as TMyProperties)
  .Width := (Sender as TJvSpinEdit).AsInteger; (Properties as TMyProperties)
  .MyMethod;
end;


That's a bug and already reported to QC.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK