Implement a better Code Completion

Feature requests
Post Reply
pennywise
Posts: 22
Joined: Thu Sep 11, 2008 2:18 pm

Implement a better Code Completion

Post by pennywise » Fri Nov 28, 2008 3:47 pm

Code: Select all

var myObject = function() {
	var self = this;
	/** @private */
	var myVar = 0;
	/** @private */
	var myFunc = function() {
		return myVar + self.myPubVar; // no code completion for self.*
	};
    /** @private */
	var myFunc2 = function() {
		return myFunc() + self.myPubFunc(); // no code completion for self.*
	}
};

myObject.prototype = {
	/** @public */
	myPubVar : 0,
	/** @public */
	myPubFunc : function() {
		return myVar + this.myPubVar; // no code completion for myVar
	},
    /** @public */
	myPubFunc2 : function() {
		return myFunc() + this.myPubFunc(); // no code completion for myFunc()
	}
};
As far as I know, this is correct Javascript. But as said in the comments, no code completion :)

pennywise
Posts: 22
Joined: Thu Sep 11, 2008 2:18 pm

Post by pennywise » Mon Dec 01, 2008 10:38 am

ok, I was wrong. correct would be

Code: Select all

var myObject = function() {
	var self = this;
	/** @private */
	var myVar = 0;
	/** @private */
	var myFunc = function myFunc() {
		return myVar + self.myPubVar; // no code completion for self.*
	};
	/**
	 * this function is "privileged", so both public and private members are
	 * available
	 * 
	 * @public
	 */
	this.myPubFunc2 = function myPubFunc2() {
		return this.myPubFunc(); // no code completion for myPubFunc() from
									// prototype
	}
};

myObject.prototype = {
	/** @public */
	myPubVar : 0,
	/** @public */
	myPubFunc : function() {
		return this.myPubFunc2() + this.myPubVar; // no code completion for
													// myPubFunc2()
	}
};
I'm still not sure about access between prototype and the object itself, but at least the "self" should be available inside the private method.

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

Post by eric_suen » Mon Dec 01, 2008 12:29 pm

Thanks for the examples, I will improve the code completion.

costinb
Posts: 3
Joined: Sun Dec 21, 2008 10:45 am

Suggestion

Post by costinb » Sun Dec 21, 2008 10:52 am

I've seen /**@type X */ has already been implemented.
An idea would be to take that a little bit further and support a syntax similar to (class)variable.
This would be useful in ExtJS callback functions, which may have their scope specified externally.

Example:

Code: Select all

(/**@type MyClass*/ this).->autocomplete for MyClass
Right now I can get autocomplete for MyClass only if I assign this to another local variable and use /**@type X */
Actually, I think this is only useful in this particular case (hinting "this"), because other variables have a declaration spot where you can hint them.

Also, thanks for a great app ;)

marcob
Posts: 5
Joined: Wed Sep 24, 2008 2:37 am

Post by marcob » Mon Jun 29, 2009 11:13 pm

eric_suen wrote:Thanks for the examples, I will improve the code completion.
A lot of time went by since the last update.

I there a new improved version planned? When will it come out?

We bough 3 licenses, we need some more, but considering Spket brings nothing new and Aptana updates its application regularly, I don't know whether I'd keep buying Spket. We'd love to see a more active Spket development, Aptana is quite bloated for our taste, but this won't keep us forever on your boat.

Think about it. A product such as yours needs to be kept up to date.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests