visual studio 2012 - single intellisense file for multiple js function files? -
i have functions1.js, functions2.js , functions3.js. each has function, funca, funcb , funcc respectively. created file called "functions.intellisense.js" , added _reference.js. added reference _reference.js in test.js file.
why doesn't intellisense work?
functions.intellisense.js
intellisense.annotate(funca, function () { /// <signature> /// <summary>function a</summary> /// </signature> }); intellisense.annotate(funcc, function () { /// <signature> /// <summary>function a</summary> /// <param name="message">message</param> /// </signature> });
_reference.js
/// <reference path="functions.intellisense.js" />
functions1.js
function funca() { alert("this function a"); }
functions3.js
function funcc(message) { alert("this function c " + mesage); }
test.js
/// <reference path="scripts/_reference.js" /> func //<--- expecting show intellisense
is possible this? i'd couple reasons, first of combining documentation. secondly, i'd able pre-document functions. maybe prepend ideas "todo" if haven't written test.add() function, still put in intellisense file , popup "todo: adds test".
i commented how have setup references - have declare functions before they're passed intellisense.annotate if want them appear in intellisense. function declaration drives intellisense completion list, annotate call updates documentation declared function.
i'd able pre-document functions. maybe prepend ideas "todo" if haven't written test.add() function, still put in intellisense file , popup "todo: adds test".
you writing own helper intellisense, example:
function stubfunction(functionname, annotation) { if (!window[functionname]) { window[functionname] = function () { }; } intellisense.annotate(window[functionname], annotation); }
calling stubfunction
create stub function declaration , annotate in 1 call:
stubfunction("funca", function () { /// <signature> /// <summary>function important</summary> /// </signature> });
now, if type func
in editor, you'll see funca appear in completion list documentation comments.
this stubfunction
utility placed in functions.intellisense.js , used in file pre-document functions.
Comments
Post a Comment