brackets-QuickDocsJS
brackets-QuickDocsJS copied to clipboard
Doesn't work with prototype functions
I cannot get the documentation to show for the prototypes of a function. Example:
/**
@class View
@constructor
*/
function View () {}
/**
@method render
*/
View.prototype.render = function (data) {}
Using QuickDocs on the second function returns the "No Quick Docs available for current cursor position", even if the cursor is ontop of View. This, however, works:
/**
@class View
@constructor
*/
function View () {}
/**
@method render
*/
View.render = function (data) {}
Thanks I will have a look later today.
Can you @OttoRobba send me the code where you want to get the QuickDocs? So in which way do you call the View.render
function?
A more concrete example:
/**
* @namespace ox
*/
var ox = {};
/**
* Creates a sprite!
* @class Sprite
* @memberof ox
* @param {String} src image source file
* @example var player = new ox.Sprite("player.png");
*/
ox.Sprite = function (src) {
this.x = 0;
this.y = 0;
this.alpha = 1;
this.src = src;
return this;
};
/** @lends ox.Sprite.prototype */
/**
* Crops the image
* @memberof ox.Sprite
* @param {Number} x
* @param {Number} y
* @param {Number} w
* @param {Number} h
*/
ox.Sprite.prototype.crop = function (x, y, w, h) {
return this;
}
I mean sth. like:
/**
* [[Description]]
* @param {[[Type]]} abc [[Description]]
*/
Array.prototype.stuff = function(abc) {
}
var arr = ['abc','def'];
arr.stuff('abc');
is working cause the program gets that arr
is an array so it can check Array.prototype
function.
But it's probably hard to determine the type of the variable for other types :/ On the other hand if someone has two prototypes one with Array
and one with View
where the function name is the same I don't want to show the first one I can get.
I can see how this is a difficult problem. Very likely I'm being naïve here but for anything that is not monkey patching, wouldn't just using the information from @memberof solve this? It is telling us who it belongs to, just treat it as a method of that member.
Well unfortunately it isn't that easy cause I can't run your code to get this information. So I have to rebuilt the memberof
function just by reading the code. At the moment I don't parse your whole code. I'm just using regex to "understand" it and this is probably the problem :/ but I think it's hard to change everything and I never worked with parser before.