简体   繁体   English

Visual Studio JavaScript智能感知自定义

[英]Visual Studio javascript intellisense customization

I am trying to customize intellisense in a javascript function in visual studio without annotating the function. 我正在尝试在Visual Studio中的javascript函数中自定义intellisense,而无需对其进行注释。

I have tried to push my own items: 我尝试过推自己的物品: 在此处输入图片说明

but unfortunately this has no effect when toto has not been initialized somewhere. 但是不幸的是,当尚未在某处初始化toto时,这无效。 But if toto exists: 但是,如果toto存在:

在此处输入图片说明

so... simple question, is there a way to make the toto completion behave as if it have been defined? 所以...一个简单的问题,有没有办法使toto完成行为就像已定义的那样? Is there a flag I missed? 我错过了一个标志吗?

Here are the fields I have found on the event args "e", 这是我在事件args“ e”上找到的字段,

  • on undefined toto: 在未定义的toto上:
    • target: null (undefined) 目标:null(未定义)
    • targetName: toto (string) targetName:toto(字符串)
    • items: (Array) 项目:(数组)
    • scope: members (string) 范围:成员(字符串)
    • _$items: (Array) _ $ items:(数组)

  • on defined toto: 在定义的toto上:
    • target: 1 (number) 目标:1(数量)
    • targetName: toto (string) targetName:toto(字符串)
    • items: [object Object],... (Array) 项目:[object Object],...(数组)
    • scope: members (string) 范围:成员(字符串)
    • _$items: [object Object],... (Array) _ $ items:[对象对象],...(数组)

I have tried to change several field values, I does not seem to have any effect. 我试图更改多个字段值,但似乎没有任何效果。 I am using VS2013 我正在使用VS2013

ok, I found a way to add intellisense to function parameters without param annotations. 好的,我找到了一种在没有参数注释的情况下向功能参数添加智能感知的方法。 If the function has been called during intellisense runtime life cycle, it stores the type of the value passed into parameter. 如果在智能运行时生命周期中调用了该函数,则它将存储传递给参数的值的类型。 Here I call my method with number 5, the completion behaves as if toto was of type Number. 在这里,我用数字5调用我的方法,补全的行为就像toto是Number类型。

在此处输入图片说明

Moreover, I found this: 此外,我发现了这一点:

from msdn: http://msdn.microsoft.com/en-us/library/hh395059.aspx 来自msdn: http//msdn.microsoft.com/en-us/library/hh395059.aspx

A parameter is declared, but it has not been called elsewhere in the active document, as shown in the following example. 声明了一个参数,但未在活动文档中的其他位置调用它,如以下示例所示。

function illuminate(light) {
         light.  // Accurate statement completion is not available 
                 // unless illuminate is called elsewhere with a 
                 // parameter that has a value. If it is called only
                 // in a function that is a sibling to 
                 // illuminate(light) in the call hierarchy, the 
                 // IntelliSense engine also cannot determine the 
                 // parameter type.
     }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM