code assist/completion with js objects

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

code assist/completion with js objects

#1

Postby dvanhussel » Sat Feb 02, 2013 1:44 pm

Hi,
If I create a JS object like this:

Code: Select all

/**
 * Creates a formstate object
 * @constructor
 * @public sessionID
 * 
 */
function FormState()
{
	
	this.sessionID = 'test';
}
using it like this works as expected (the value test is assigned to the form-field):

Code: Select all

var test = new FormState();
fields.TEST.value = test.sessionID;
using ctrl+space on a new line in the editor shows the JavaDoc for FormState() and test appears in the list as:
test: FormState
So, the editor knows that test is an object of type 'FormState'.

But when I use ctrl+space on 'test.' the code completion doesn't show that there is a valid property 'sessionID'.

Is there a way (with JavaDoc notation?) to make this work?

It would be especially handy when using objects from other scripts of which the properties are 'unknown' to the developer using the object.

Thanks,

David
0 x

Steve
Moderator
Moderator
Posts: 423
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Mon Feb 04, 2013 9:03 am

Hi David,

No, there is no way of doing this at the moment. This maybe something that is considered in the future, but this is not that easy when working with JavaScript objects. I am not sure that eclipse can handle objects like this either.

Firstly though, I need to handle functions correctly. I have only added basic functionality (return types) from functions... e.g

var a = testMe(); //resolves as number

function testMe()
{
return 1;
}

---------------------------------------------

It is on the list of things to look at.

Kind regards

Steve
0 x

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#3

Postby dvanhussel » Tue Feb 05, 2013 11:26 am

Hi Steve,

I don't have Eclipse installed. But when I try this in NetBeans (1.7.2) or Visual Studio 2012, code completion does 'know' that test.sessionID exists.

So, it should be possible to implement it ;-)

Thanks for your answer!

Regards,

David
0 x

Steve
Moderator
Moderator
Posts: 423
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Thu Feb 07, 2013 9:29 am

Thanks for that. Most things are possible and this is, but will mean I will have to invest some time on it.

It is on my list of things to look at :)

Steve
0 x


Who is online

Users browsing this forum: No registered users and 40 guests