Switch return type for Code Completion

Get help with Spket IDE.
Post Reply
Sorbing
Posts: 27
Joined: Wed Oct 19, 2011 2:52 pm
Location: Ukraine, Kyiv
Contact:

Switch return type for Code Completion

Post by Sorbing » Fri Mar 02, 2012 5:21 pm

How to learn Spket understand such constructions in code completion?
For example for the method of jQuery height():

Code: Select all

/**
 * Get/Set the height
 * @param	{String}	value	height in px
 * @return
 */
$.prototype.height = function(value) {
	if (value) {
		 return new jQuery;
	} else {
		return new Number;
	}
};

$().height(100). | Need to Complete methods for jQuery Object
$().height(). | Need to Complete methods for Number Object
Now parser Spket returns the first found type (object). It is not possible to document the overloaded methods.
Thank you.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Re: Switch return type for Code Completion

Post by eric_suen » Sat Mar 03, 2012 7:01 pm

It can be done with @return {jQuery/Number} , the code assist will list all properties in jQuery and Number, that works for other library, jQuery supports seems has a bug.

Sorbing
Posts: 27
Joined: Wed Oct 19, 2011 2:52 pm
Location: Ukraine, Kyiv
Contact:

Re: Switch return type for Code Completion

Post by Sorbing » Mon Mar 05, 2012 9:43 am

Thank you а solution. It's better, than nothing )).
Now in Spket code completion is implemented better than in other JS-editors (IDE).
But I'm waiting a solution for documentation of overloaded methods.
Do you plan to make an intelligent parser JS-documentation?
Thanks for your help.
P.S. What does this phrase - "jQuery supports seems has a bug". Sorry, my english is not so good.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Re: Switch return type for Code Completion

Post by eric_suen » Mon Mar 05, 2012 1:25 pm

Sorbing wrote:But I'm waiting a solution for documentation of overloaded methods.
Do you plan to make an intelligent parser JS-documentation?
Could you give more detail?
Sorbing wrote:P.S. What does this phrase - "jQuery supports seems has a bug". Sorry, my english is not so good.
If you add that document to library, it will not work, for jQuery, it always return jQuery and ignore the documentation.

Sorbing
Posts: 27
Joined: Wed Oct 19, 2011 2:52 pm
Location: Ukraine, Kyiv
Contact:

Re: Switch return type for Code Completion

Post by Sorbing » Mon Mar 05, 2012 2:12 pm

Could you give more detail?
Is it possible to do that would Spket parse simple ternary operators (in body methods) and return the data type, depending on conditions.
Example condition in first my comment.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests