Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript intellisense.js文件_Javascript_Com_Visual Studio 2015_Intellisense - Fatal编程技术网

JavaScript intellisense.js文件

JavaScript intellisense.js文件,javascript,com,visual-studio-2015,intellisense,Javascript,Com,Visual Studio 2015,Intellisense,我的问题是,我没有在VisualStudio中实现intellisense,这有什么不对 我正在尝试创建一个JavaScript程序,它包装COM对象,稍微扩展它,并为COM对象属性提供intellisense JavaScript文件: jscript.js function wrapper(inject) { inject.state = 0; return inject; } 智能感知文件: jscript.intellisense.js function _wrappe

我的问题是,我没有在VisualStudio中实现intellisense,这有什么不对

我正在尝试创建一个JavaScript程序,它包装COM对象,稍微扩展它,并为COM对象属性提供intellisense

JavaScript文件: jscript.js

function wrapper(inject)
{
    inject.state = 0;
    return inject;
}
智能感知文件: 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);
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
    }
}
函数_wrapper()
{
返回{
///存储对象的状态
州:0,
///这是一个com属性
康普:是的
}
}
intellisense.annotate(包装器,_包装器);
HTML文件: index.html

<script>
    var com = new wrapper({});

    com.*  // <-- the intellisense should be reflected here but it isn't

</script>

var com=新包装({});

com.*/我能够解决这个问题,经过长时间的反复试验,我想出了这个解决方案:

尽管MSDN要求使用intellisense.annotate函数,但我发现让它正常工作的唯一方法是在intellisense文件中完全声明对象。因此,我的新intellisense文件如下所示:

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);
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
    }
}
函数包装器()
{
///有效的包装纸
///将我的COM对象注入此处
/// 
返回{
///存储对象的状态
州:0,
///这是一个com属性
康普:是的
}
}
没有intellisense.annotate()函数调用。这是一个简单得多的解决方案,也是我能找到的唯一一个将intellisense保持在多个树级别的解决方案

对我来说,这大多是未经测试的,如果有人发现此解决方案存在问题,请提供答案,我将保留问题