Recent

Author Topic: Class completion: why prepend instead of append?  (Read 5210 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Class completion: why prepend instead of append?
« on: October 25, 2015, 06:52:21 pm »
Been wondering this for a long time, I wonder why class completion works by prepending on existing implementation section instead of appending it?

For example, if I have:
Code: Pascal  [Select][+][-]
  1. type
  2.   TClass1 = class
  3.     procedure p;
  4.   end;
  5.  
  6.   TClass2 = class
  7.     procedure p;
  8.   end;
  9. end;
  10.  
and do class completion on TClass1 followed by TClass2, I will get:
Code: Pascal  [Select][+][-]
  1. { TClass2 }
  2.  
  3. procedure TClass2.p;
  4. begin
  5.  
  6. end;
  7.  
  8. { TClass1 }
  9.  
  10. procedure TClass1.p;
  11. begin
  12.  
  13. end;
  14.  
instead of:
Code: Pascal  [Select][+][-]
  1. { TClass1 }
  2.  
  3. procedure TClass1.p;
  4. begin
  5.  
  6. end;
  7.  
  8. { TClass2 }
  9.  
  10. procedure TClass2.p;
  11. begin
  12.  
  13. end;
  14.  
For consistency with order in interface section, I'd like to get the second version. I don't see anything that makes it possible in existing code tools options, but I might be wrong.

Thaddy

  • Hero Member
  • *****
  • Posts: 14160
  • Probably until I exterminate Putin.
Re: Class completion: why prepend instead of append?
« Reply #1 on: October 25, 2015, 07:06:41 pm »
Mm, while testing some stuff regarding generics today, I noticed that the older versions of Delphi try to append, which screws up your code ;) (Ahum, writing - not compiling -
generics code in D7 IDE ;), Ahum)

It seems to me that if you prepend the code it avoids that kind of issues. Ahum.

As long as you navigate with the ctrl-shift <C,down,up> I see no problem except natural order.

But you have a point there. Just gave you an example why it may be useful or even intended in the Lazarus IDE.
« Last Edit: October 25, 2015, 07:39:25 pm by Thaddy »
Specialize a type, not a var.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Class completion: why prepend instead of append?
« Reply #2 on: October 26, 2015, 12:21:34 am »
I unfortunately don't know the solution, but the behaviour has been bugging me too. :-/
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Class completion: why prepend instead of append?
« Reply #3 on: October 26, 2015, 02:15:54 am »
As long as you navigate with the ctrl-shift <C,down,up> I see no problem except natural order.
That's the original problem actually. My coding needs these days is in server environment. Sometimes I need to change code right on the server to make sure things work first (there are certain occasions when things are hard to test locally, thus needing on site testing), and only then bring it back to my computer to commit it to VCS. Certainly I can't use Lazarus there for the interface/implementation jump :/ unless we have FreeVision backend for LCL and Lazarus can be compiled for it.

 

TinyPortal © 2005-2018