JavaScript code completion seems doesn't work

Get help with Spket IDE.
Post Reply
Filip.Jirsak
Posts: 1
Joined: Mon Feb 26, 2007 12:53 pm

JavaScript code completion seems doesn't work

Post by Filip.Jirsak » Mon Feb 26, 2007 1:05 pm

Hello,
I have simple JS file in eclipse opened in Spket JavaScript editor:

Code: Select all

/**
 * @param {String} p parameter no 1
 */
function test(p) {
	p.|
}
When I type dot or press Ctrl+Space code comlpetion starts. But it shows templates only. But I expect (according to tutorial) there should be sugestions for String object (e.g. charAt(), charCodeAt() and so on).

Am I writing JSDoc wrong? Or is there another problem?

Thanks.

(eclipse 3.2.2, spket 1.5.3)

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

Post by eric_suen » Mon Feb 26, 2007 4:42 pm

It's a bug, when the function body is empty or the first variable is the parameter, the code comlpetion not works, that means, the code completion will works for code like this:

Code: Select all

/** 
 * @param {String} p parameter no 1 
 */ 
function test(p) {
  var i;
  p.|
}
The next version will fix the bugs

Thanks

Eric

cafebabe
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

not working for me

Post by cafebabe » Tue Mar 31, 2009 9:34 pm

I am using eclipse 3.3.1.1 and spket 1.6.16 .

here is the code

Code: Select all

Ext.ux.MyClass = Ext.extend(Ext.Panel, {
    stateId: 'myUniqID'
    /**
     * @param {Ext.EventObject} p
     */
    ,doStuff : function(p){
    	p.
    }
});
p does not auto complete however if i switch them around

Code: Select all

Ext.ux.MyClass = Ext.extend(Ext.Panel, {
    /**
     * @param {Ext.EventObject} p
     */
    doStuff : function(p){
    	p.
    }
    ,stateId: 'myUniqID'
});
I do get code complete on p. Furthermore it seems that any function that is not the first function in a class does not get code complete.

It seems to be an issue with leading commas as opposed to trailing commas =\

We have a lot of preexisting code using leading commas and rewriting our code is not an option. The reasons leading commas were chosen is detailed here

blog.extjs.eu/philosophy/leading-comma-or-trailing-comma-that-is-the-question/

please advise.

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

Post by eric_suen » Wed Apr 01, 2009 2:51 am

That because your jsdoc in wrong place, the code should like

Code: Select all

Ext.ux.MyClass = Ext.extend(Ext.Panel, {
  stateId: 'myUniqID'
  ,
  /**
   * @param {Ext.EventObject} p
   */
  doStuff : function(p){
    p.
  }
});
, the jsdoc should after comma, or you can use inline comment like

Code: Select all

Ext.ux.MyClass = Ext.extend(Ext.Panel, {
  stateId: 'myUniqID'
  ,doStuff : function(/*Ext.EventObject*/p){
    p.
  }
});

cafebabe
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

Post by cafebabe » Wed Apr 01, 2009 6:07 pm

I have not been able to find the jsdoc specification that states these comments are in the wrong place, I have however compiled this simple test and run it through the jsdoc-toolkit which AFAIK is the offical jsdoc project. The command used is this

Code: Select all

java -jar jsrun.jar app/run.js -t=templates/jsdoc/ test.js
The resulting html show the correct parameter types for the functions defined in this simple class.

Code: Select all

/**
 * @class myClass
 * @type Object
 */
myClass = {
    /**
     * @param {String} p
     */
    doStuff : function(p){
    	p.length;
    }
    ,stateId: 'myUniqID'
    /**
     * @param {String} x
     */
    ,doMoreStuff : function(x){
    	x.length;
    }
};
We not only have internal code but also use plugins written by other members in the community. It would take a considerable amount of effort to modify all of this code not to mention future updates of these plugins.

If parsing of jsdoc comments w/ leading commas will not be integrated to spket is there a workaround or any other way we could obtain code complete using this leading comma format ?

regardless I appreciate your time in helping me resolve this issue

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

Post by eric_suen » Thu Apr 02, 2009 3:35 am

I have upload a quick fix, please download http://www.agpad.com/downloads/com.spket.js_1.6.16.jar and replace the old one.

cafebabe
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

Post by cafebabe » Thu Apr 02, 2009 3:10 pm

you have just save me from countless hours in re-editing code. I droped it in as a replacement in the plugins folder and all is well in the world.


Can not express enough thanks.

Thanks !

Exception e
Posts: 18
Joined: Tue Aug 05, 2008 12:40 pm

Post by Exception e » Sat Apr 18, 2009 7:49 pm

eric_suen wrote:I have upload a quick fix, please download and replace the old one.
Whoa Eric, you rock. I favor comma-in-front style too, because a missing comma will then be easier to spot

Post Reply

Who is online

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