Jump to content
Sign in to follow this  
dummzeuch

auto fill parameters

Recommended Posts

I remember that for one particular Delphi version there was a hidden Code Insight option to automatically fill in the parameters for a function call.

 

What I mean by that is, given a function declared as

function bla(FirstParam, SecondParam: integer; out ThirdParam: string): byte;

when you enter a call to it in the editor

MyVar := bla( 

and press some hotkey, the function call would be automatically completed as

 MyVar := bla(FirstParam, SecondParam, ThirdParam);

I don't mean the hint on parameters that is still available, but actually adding this text into the editor.

To enable this, you needed to set a particular registry key.

This was only possible in one particular Delphi version (2006?) and was removed in the next version.

If I remember correctly some Borland (Inprise / Codegear ?) employee blogged about it.

 

Does anybody remember the specifics?

Edited by dummzeuch

Share this post


Link to post
7 hours ago, dummzeuch said:

I remember that for one particular Delphi version there was a hidden Code Insight option to automatically fill in the parameters for a function call.

 

What I mean by that is, given a function declared as


function bla(FirstParam, SecondParam: integer; out ThirdParam: string): byte;

when you enter a call to it in the editor


MyVar := bla( 

and press some hotkey, the function call would be automatically completed as


 MyVar := bla(FirstParam, SecondParam, ThirdParam);

I don't mean the hint on parameters that is still available, but actually adding this text into the editor.

To enable this, you needed to set a particular registry key.

This was only possible in one particular Delphi version (2006?) and was removed in the next version.

If I remember correctly some Borland (Inprise / Codegear ?) employee blogged about it.

 

Does anybody remember the specifics?

I don't think that ever existed. If it did it would be completely useless since the actual variables you pass to a function call are rarely (in my case never :classic_dry:) named the same as the parameters in the function declaration.

Share this post


Link to post
8 hours ago, PeterBelow said:

I don't think that ever existed. If it did it would be completely useless since the actual variables you pass to a function call are rarely (in my case never :classic_dry:) named the same as the parameters in the function declaration.

I'm 100% sure that it existed and that I used it at some time. I also remember being disappointed when it didn't turn up as a regular feature in the next Delphi version and couldn't be activated any more.

 

As for it being useless, I disagree. It's useful if your calling code is just a small function and you don't have to think about naming those variables and typing them. Thus it promotes better variable names. It also prevents typing mistakes.

Edited by dummzeuch

Share this post


Link to post

Wouldn't a custom template do?  Hitting CreateC shown with  Control-J yields 

 

constructor Create(AOwner: TComponent); override;

 

 

Share this post


Link to post
10 hours ago, Pat Foley said:

Wouldn't a custom template do?  Hitting CreateC shown with  Control-J yields

No, because that would only create the code for one particular function call. What I'm after is generating the code for any function that's available through Ctrl+Space.

Share this post


Link to post

You are saying local variable names are prefixed with 'a' when your function is used?  That lets the person reading the code know what variables are to be touched outside the procedure.  That's better than marking the variables that are not touched outside a procedure with an L.    

 

I think the Help insight control J s for summary is good.  It has better latency than the 

Control Space business. 

 
 

    

Share this post


Link to post
1 hour ago, Pat Foley said:

You are saying local variable names are prefixed with 'a' when your function is used?   

No, I'm not saying that.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×