Prevent methods with empty bodies from deletion on save

后端 未结 3 2115
后悔当初
后悔当初 2021-01-18 13:24

It\'s quite a contradictory habit of mine to press Ctrl+S permanently. The negative side is that delphi deletes empty functions/procedures on save.

Is there a way t

3条回答
  •  温柔的废话
    2021-01-18 13:41

    Just add an empty comment like //

    begin 
    //
    end;
    

    an other way would by moving the declaration to the published part

    type
      TForm5 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject); // will be removed if empty
      private
        { Private-Deklarationen }
      public
      published
        procedure Button2Click(Sender: TObject); // will not be removed if empty
    
        { Public-Deklarationen }
      end;
    

提交回复
热议问题