簡體   English   中英

Delphi IDE奇怪的源代碼格式

[英]Delphi IDE weird source code formatting

有時在 Delphi IDE 中按下某些鍵后,所有函數標題都會變成這樣:

constructor TClient.Create(

  const AServer: TServer;

  const APhone: AnsiString);

這有點煩人,因為代碼格式化程序(CTRL-D)無法正確修改此類代碼,我必須手動刪除所有換行符。 它是如何發生的?

我發現它實際上是如何發生的,並且可以重復這些格式化結果:使用特定的 sintax 錯誤格式化代碼,更正代碼,然后再次格式化。 示例在這里:

type
  TTableDesc = record
    constructor Create(););
  end;

  function func(const a: string; const b: Boolean; const c: pointer): string;

在我上面提到的動作之后,你會得到這個:

type
  TTableDesc = record
    constructor Create();
  end;

function func(

  const a: string;

  const b: Boolean;

  const c: pointer): string;

避免它的最好方法就是不要格式化有錯誤的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM