Have you guys and gals got any tips or hacks for making the most out of the JavaScript intellisense options in Visual Studio 2008?
你们有没有得到任何提示或黑客,以充分利用Visual Studio 2008中的JavaScript intellisense选项?
Visual Studio shows me the "namespaces" and uses the documentation features (<param>
and <summary>
). I have not been able to get the <return>
documentation feature to work though.
Visual Studio向我显示“名称空间”并使用文档功能(和
Now, that's all well and good. But when I call a privileged function, Visual Studio does not know about it, and thus I get no documentation.
现在,这一切都很好。但是当我调用特权函数时,Visual Studio并不知道它,因此我没有得到任何文档。
Is there any way I can expose public variables and privileged functions to Visual Studios intellisense functionality, while still creating objects with private members?
有没有什么方法可以将公共变量和特权函数暴露给Visual Studios智能感知功能,同时仍然使用私有成员创建对象?
1 个解决方案
#1
4
Javascript Intellisense is definitely flaky as far as recognizing function members. I've had slightly more success using the prototype paradigm, so that's something you could check out. Often times, though, I find it still won't reliably list functions in the Intellisense.
Edit: As the original poster suggested in the comments below, it's not really possible to get the same "private" functionality in the prototype model. Javascript doesn't have a concept of private members, but you can emulate member privacy with closure by declaring them in the function constructor. The means though that if you have functions that need to access members, they have to be in the constructor too, so they can't be prototypes.
So while using the prototype model may (or may not) give you better VS Intellisense, it's only useful for public functions that hit public members, and can't be used to improve intellisense for private or privileged functions. Private functions you probably don't want intellisense anyway, but privileged you likely would.
就识别函数成员而言,Javascript Intellisense肯定是片状的。我使用原型范例稍微有点成功,所以你可以查看一下。但是,很多时候,我发现它仍然不能可靠地列出智能感知中的功能。编辑:正如下面评论中提到的原始海报,在原型模型中实际上不可能获得相同的“私人”功能。 Javascript没有私有成员的概念,但您可以通过在函数构造函数中声明成员隐私来模拟成员隐私。但是,如果你有需要访问成员的函数,它们也必须在构造函数中,因此它们不能是原型。因此,虽然使用原型模型可能(或可能不)为您提供更好的VS智能感知,但它仅对公共成员有用,并且不能用于改善私有或特权函数的智能感知。你可能不想要智能感知的私人功能,但你可能会有特权。
#1
4
Javascript Intellisense is definitely flaky as far as recognizing function members. I've had slightly more success using the prototype paradigm, so that's something you could check out. Often times, though, I find it still won't reliably list functions in the Intellisense.
Edit: As the original poster suggested in the comments below, it's not really possible to get the same "private" functionality in the prototype model. Javascript doesn't have a concept of private members, but you can emulate member privacy with closure by declaring them in the function constructor. The means though that if you have functions that need to access members, they have to be in the constructor too, so they can't be prototypes.
So while using the prototype model may (or may not) give you better VS Intellisense, it's only useful for public functions that hit public members, and can't be used to improve intellisense for private or privileged functions. Private functions you probably don't want intellisense anyway, but privileged you likely would.
就识别函数成员而言,Javascript Intellisense肯定是片状的。我使用原型范例稍微有点成功,所以你可以查看一下。但是,很多时候,我发现它仍然不能可靠地列出智能感知中的功能。编辑:正如下面评论中提到的原始海报,在原型模型中实际上不可能获得相同的“私人”功能。 Javascript没有私有成员的概念,但您可以通过在函数构造函数中声明成员隐私来模拟成员隐私。但是,如果你有需要访问成员的函数,它们也必须在构造函数中,因此它们不能是原型。因此,虽然使用原型模型可能(或可能不)为您提供更好的VS智能感知,但它仅对公共成员有用,并且不能用于改善私有或特权函数的智能感知。你可能不想要智能感知的私人功能,但你可能会有特权。