[英]Delphi IDE weird source code formatting
Sometimes after pressing some keys in Delphi IDE all functions headers become looking like this:有时在 Delphi IDE 中按下某些键后,所有函数标题都会变成这样:
constructor TClient.Create(
const AServer: TServer;
const APhone: AnsiString);
It's a little annoying cause the code formatter (CTRL-D) cannot amend such code properly and I have to remove all line breaks manually.这有点烦人,因为代码格式化程序(CTRL-D)无法正确修改此类代码,我必须手动删除所有换行符。 How does it happen?它是如何发生的?
I found how it actually happens and can repeat these formatting results: you format the code with the specific sintax error, correct the code and then format it again.我发现它实际上是如何发生的,并且可以重复这些格式化结果:使用特定的 sintax 错误格式化代码,更正代码,然后再次格式化。 The example is here:示例在这里:
type
TTableDesc = record
constructor Create(););
end;
function func(const a: string; const b: Boolean; const c: pointer): string;
After the actions I mentioned above you'll get this:在我上面提到的动作之后,你会得到这个:
type
TTableDesc = record
constructor Create();
end;
function func(
const a: string;
const b: Boolean;
const c: pointer): string;
The best way to avoid it is just not to format the code with errors.避免它的最好方法就是不要格式化有错误的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.