如何防止代码格式化程序执行此操作?看起来它会以“as”的方式移动演员阵容。这是一个错误,还是格式化程序中有任何设置?
// 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 :(得分:1)
一个解决方法是对行尾的评论:
if Assigned(aDBControl) then //
(aDBControl as TcxDBLookupComboBox)
.Properties.ListSource := aDataSource;
这不理想,下一行的缩进是错误的,但它比等待更新2修复它更好。
编辑:一个包围安全演员阵容的硬拼图稍好一些。
if Assigned(aDBControl) then
TcxDBLookupComboBox(aDBControl as TcxDBLookupComboBox)
.Properties.ListSource := aDataSource;
答案 1 :(得分:0)
这是一个错误,已经reported to QC。