Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Class Completion    [ Add a report in this area ]  
Report #:  88569   Status: Open
Class completion inserts code to the wrong place
Project:  Delphi Build #:  14.0.3593.25826
Version:    14.0 Submitted By:   David Tetard
Report Type:  Basic functionality failure Date Reported:  10/1/2010 11:42:50 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   280659
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I like to format my procedures the following way, with a header describing its use (which is not an uncommon habit I believe):

// -------------------------------------------------------------------------------------
// This procedure does blah blah blah.
// It returns blah blah blah.
// aParam: This is blah blah blah
Function DoSomething(Const aParam : TXXX) : Integer;
Begin
     ...
End;


However, when some class methods are inserted (Ctrl + Shift + C), they very often go between the header and the lines of another method (see steps on the right).

Steps to Reproduce:
This is the start unit:

==================================================================
Unit Unit11;

Interface

Uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;

Type
TForm11 = Class(TForm)
Private
  { Private declarations }
Public
  Procedure aaaa;
  Procedure bbbb(Const xxx : String);
  procedure cccc;
  Procedure Baaa;
End;

Var
Form11: TForm11;

Implementation

{$R *.dfm}


// ----------------------------------------------------------------------------
// This procedure dies blah blah blah.
procedure TForm11.aaaa;
begin

end;


// ----------------------------------------------------------------------------
// This procedure does blah blah blah.
// XXX is blah blah blah.
procedure TForm11.bbbb(Const xxx : String);
begin

end;


// -----------------------------------------------------------------------------
// This procedure does blah blah blah.
// blah blah blah.
procedure TForm11.cccc;
begin

end;


End.


====================================================================================

Now, press Ctrl + Shift + C to have the Baaa procedure automatically inserted  in the code. The result is:

// ----------------------------------------------------------------------------
// This procedure dies blah blah blah.
procedure TForm11.aaaa;
begin

end;


// ----------------------------------------------------------------------------
// This procedure does blah blah blah.                             <=== Description for bbbb
// XXX is blah blah blah.
procedure TForm11.Baaa;                                                <==== Insreted code.
begin

end;

procedure TForm11.bbbb(Const xxx : String);                    <==== bbbb has lost its header.
begin

end;


// -----------------------------------------------------------------------------
// This procedure does blah blah blah.
// blah blah blah.
procedure TForm11.cccc;
begin

end;


Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01