Delphi 2010代码格式化程序:“;(MyVar作为TMyType).MyMethod“;被分成两行

Delphi 2010代码格式化程序:“;(MyVar作为TMyType).MyMethod“;被分成两行,delphi,formatting,delphi-2010,Delphi,Formatting,Delphi 2010,如何防止代码格式化程序执行此操作?它似乎总是以“as”来移动演员阵容。这是一个bug,还是格式化程序中有任何设置 // Before formatting: procedure TMyFrame.WidthEditChange(Sender: TObject); begin (Properties as TMyProperties).Width := (Sender as TJvSpinEdit).AsInteger; end; // After formatting: procedur

如何防止代码格式化程序执行此操作?它似乎总是以“as”来移动演员阵容。这是一个bug,还是格式化程序中有任何设置

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

这是一个bug,而且已经存在。

一个解决方法是在行的末尾添加注释:

   if Assigned(aDBControl) then //
   (aDBControl as TcxDBLookupComboBox)
      .Properties.ListSource := aDataSource;
这并不理想,下一行的缩进是错误的,但这比等待更新2是否修复它要好

编辑:硬石膏包裹安全石膏效果稍好

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