views:

63

answers:

2

Is it possible to hide certain functions/fields from displaying in javascript intellisense drop down list in Visual Studio 2008? Either by javascript documentaion XML of by naming privates in a certain way?

I've seen <private /> in jquery vsdoc file that implies exactly this behaviour, but doesn't meet my expectations

{
    __hiddenField: 0,
    /// <private />
    increment: function(){
        /// <summary>Increments a private variable</summary>
        __hiddenField++;
    }
}

But since fields can't contain documentation (because they have no body) they have to be documented at the top. But still doesn't work:

{
    /// <field name="__hiddenField" type="Number" private="true">PRIVATE USE</field>
    __hiddenField: 0,
    increment: function(){
        /// <summary>Increments a private variable</summary>
        __hiddenField++;
    }
}

Impossible is a perfectly possible answer and will be accepted if you have the knowledge that it's actually not possible.

A: 

I think to make a function/field private you should add a hyphen before its name.

_increment: function(){
    /// <summary>Increments a private variable</summary>
    __hiddenField++;
}
Mehdi Golchin
+1  A: 

I'm not sure about how to hide it from intellisense, but you could always use closures to hide the variable completely, like this:

(function(){
    var hiddenField = 0;

    // not sure how you're defining your object; 
    // I'll just assume a global variable
    window.something = {
        increment: function(){
            /// <summary>Increments a private variable</summary>
            hiddenField++;
        }
    }
})();

That creates an anonymous function around your definition, so window.something.increment() will work, and "hiddenField" is truly hidden.

jvenema