I am using Netbeans 6.9 and 7-Beta on Windows 7. According to Netbeans javascript documentation it should be possible to add documentation to my project and get autocompletion on my classes and functions. The trouble I am having is that I'm using my own class declaration (via a function called Class
) and can't seem to get things working. For example a simple class declaration would look like:
mySubClass = Class(parentClass, {
memberVariable: null,
/**
* @class mySubClass
* @constructor
*/
initialize: function(value开发者_如何转开发) {
this.memberVariable = value;
},
/**
* @class mySubClass
*/
getMV: function() {
return this.memberVariable;
},
/**
* @class mySubClass
*/
setMV: function(value) {
this.memberVariable = value;
}
});
I've tried many variations and placements of the declarations (@class
, @memberOf
, etc) but cannot get completion working. For example after,
var testObj = new my
I should be able to get mySubClass
by hitting "ctrl+space" and similarly proceed to:
var test = new mySubClass(1);
test.
and get options for getMV
and setMV
. Is this possible and if so, how do I do it? Thanks.
I had the same problem. Your code could have been simplified, I had to read twice to understand that Class was a custom function of yours, not js syntax..
foo.canvas = function(id) {
this.clear = function() {};
};
bar = foo.canvas("myCanvas");
bar. <-- here NetBeans doesn't suggest the "clear" function.
It seems the NetBeans doesn't do introspection well in JS. It only seems to work for native and host objects.
Try Komodo Edit, it seems to get this right.
It should work with @lends (see JSDoc-toolkit CookBook). It doesn't work in Netbeans 7.2 though (even @type and @link doesn't work).
精彩评论