2010-05-07 60 views
2

如何防止代碼格式化程序這樣做?看起來它移動與「一樣」總是排隊。這是一個錯誤,還是格式化程序中有任何設置?Delphi 2010 Code Formatter:「(MyVar as TMyType).MyMethod」分成兩行

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

這樣會很奇怪:

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

出現了一個bug給我...... – 2010-05-07 09:30:47

回答

0

這是一個錯誤,已經reported to QC

+0

這個錯誤根本無法使用codeformater。 – 2010-05-12 11:46:50

+0

不僅這個錯誤:-) – 2010-05-13 06:25:33

1

一個解決辦法是在一行的末尾評論:

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

它的效果並不理想,下一行縮進是錯誤的,但它比觀望更好,如果更新2個修復它。

編輯:一個硬鑄包裹安全演員的作品略好。

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