Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Content Assist for methods in custom editor(How to display parameter name list of a method???)
icon5.gif  Content Assist for methods in custom editor [message #632057] Mon, 11 October 2010 11:51 Go to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
I am working on developing an editor. For this editor, we need to provide content assist support. So, for that, I extended "ScriptCompletionEngine" class.

My issue is with parameter list in methods. After creating CompletionProposal for method, I set parameter values of that method. And, yeah, it is getting displayed. But as we see in Java editor, the selected parameter name is not getting highlighted in the help info balloon. If there are multiple parameter names, then when I press tab, selection goes to next paramater but at the same time the help info balloon disappears.. I tried the same in a Ruby editor and there also same thing is happening.

Also, do I need to give the parameter type along with parameter name while setting the parameter list?
eg: parameter -> param1, type int.. So the parameter name to be set in proposal.setParameterNames() is "int param1"?? Or is there any other section where I need to mention the parameter type?

Following is the summary of my requirement/issues
1) Selected parameter name is not getting highlighted.
2) Help info balloon disappears when selection is changed to next parameter by selecting tab.
3) How to display parameter type along with parameter name?

Thanks in advance,
Daisy.
Re: Content Assist for methods in custom editor [message #635446 is a reply to message #632057] Tue, 26 October 2010 19:39 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Daisy,

Looks like these items are not completely supported at the moment.
The good news they are among our short-term plans.
Please stay tuned.

Regards,
Alex
Re: Content Assist for methods in custom editor [message #635821 is a reply to message #635446] Thu, 28 October 2010 09:24 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Thank you, Alex.

Is there any expected release date for the feature?

Thanks,
Daisy.
Re: Content Assist for methods in custom editor [message #645569 is a reply to message #632057] Sat, 18 December 2010 02:09 Go to previous messageGo to next message
Carl Knight is currently offline Carl KnightFriend
Messages: 13
Registered: December 2010
Junior Member
Don't know if this helps, but here is my workaround for the same problem:

/**
 * @author carlk
 *
 */
public class UMethodProposal extends CompletionProposal {
	/**
	 * @param kind
	 * @param completionLocation
	 * @throws ModelException 
	 */
	public UMethodProposal(int completionLocation, IMethod method) throws ModelException {
		super(CompletionProposal.METHOD_REF, completionLocation);
		List<String> paramaterTypesAndNames = new ArrayList<String>();
		for( IParameter param : method.getParameters() )
			paramaterTypesAndNames.add(param.getType() + " " + param.getName());
		setParameterNames(paramaterTypesAndNames.toArray(new String[]{}));
		setFlags(method.getFlags());
	}
}


In the CompletionEngine I just create an instance of this for the proposal for methods.

- C.
Re: Content Assist for methods in custom editor [message #707407 is a reply to message #645569] Mon, 01 August 2011 16:00 Go to previous messageGo to next message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 58
Registered: January 2010
Member
Hi,
In CompletionEngine, I have the folowing code:
proposal = this.createProposal(CompletionProposal.METHOD_DECLARATION, this.actualCompletionPosition);
IMethod method = (IMethod) element;
proposal.setFlags(method.getFlags());
proposal.setParameterNames(method.getParameterNames());
proposal.setModelElement(element);
proposal.setName(name);
proposal.setCompletion(name);

I get completion only on function name, no parenthesis and worse parameters are not available to fill.
What did I miss?
Any clue?
Re: Content Assist for methods in custom editor [message #707929 is a reply to message #707407] Tue, 02 August 2011 08:34 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Hi Kevin,

proposal = this.createProposal(CompletionProposal.METHOD_DECLARATION, this.actualCompletionPosition);

In this line, for the completion proposal type, please make sure that you are looking for METHOD_DECLARATION itself. There is another type, METHOD_REF, which will complete the reference. In my case, METHOD_REF is the one that served my purpose.
Hope this helps.

Regards,
Daisy.
Re: Content Assist for methods in custom editor [message #707974 is a reply to message #707929] Tue, 02 August 2011 09:38 Go to previous message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 58
Registered: January 2010
Member
Hi,

It sure helps, I changed METHOD_DECLARATION for METHOD_REF and it works just fine.

Thanks
Previous Topic:Debug Perspective not triggering on program suspend
Next Topic:DLTK Documentation
Goto Forum:
  


Current Time: Fri Dec 06 11:05:25 GMT 2024

Powered by FUDForum. Page generated in 0.03398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top