Delphi 2010 Formatterter: "(MyVar as TMyType) .MyMethod" split into two lines

How do I prevent code formatting from doing this? He seems to move the throws with the "as" always in line. Is this a bug, or are there any formatting settings?

// 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;

      

This is strange:

// 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;

      

+2


a source to share


2 answers


This is an error message and has already been reported to QC .



0


a source


one workaround - comment at the end of the line:

   if Assigned(aDBControl) then //
   (aDBControl as TcxDBLookupComboBox)
      .Properties.ListSource := aDataSource;

      

It's not perfect, the indentation on the next line is wrong, but it's better than waiting to see if update 2 fixes.



edit: the hard injection molding of safe casting works a little better.

   if Assigned(aDBControl) then
  TcxDBLookupComboBox(aDBControl as TcxDBLookupComboBox)
    .Properties.ListSource := aDataSource;

      

+1


a source







All Articles