My question is what am I doing wrong to not get intellisense to come up in Visual Studio?
I am attempting to create a JavaScript program that wraps a COM object, extends it a little and provides intellisense for the COM object properties.
JavaScript file: jscript.js
function wrapper(inject)
{
inject.state = 0;
return inject;
}
Intellisense file: jscript.intellisense.js
function _wrapper()
{
return {
/// <field name="state" type="Number">stores state of object</field>
state:0,
/// <field name="comprop" type="Boolean">this is a com property</field>
comprop:true
}
}
intellisense.annotate(wrapper, _wrapper);
HTML file: index.html
<script>
var com = new wrapper({});
com.* // <-- the intellisense should be reflected here but it isn't
</script>
I was able to figure this one out and after a long time of trial and error, I came up with this solution:
Even though MSDN says to use the intellisense.annotate function, I found that the only way to get it to work properly was to declare the object fully inside the intellisense file. So my new intellisense file looks like this:
jscript.intellisense.js
function wrapper()
{
/// <summary>Wrapper that works</summary>
/// <param name="inject" type="String">Inject my COM object into here</param>
/// <returns type="ComObject" />
return {
/// <field name="state" type="Number">stores state of object</field>
state:0,
/// <field name="comprop" type="Boolean">this is a com property</field>
comprop:true
}
}
With no intellisense.annotate() function call. This is a far simpler solution and the only one I could find that keeps intellisense for more than one tree level.
For me, this is mostly untested, if anyone sees an issue with this solution, please provide an answer, I will leave the question open.