Visual Studio 2010 中本地变量的 Javascript Intellisense
Visual Studio 2010 中有没有办法为 Javascript 文件中的本地变量激活 Intellisense?
有一个 MSDN How-To 解释了如何为带有 XML 注释的函数参数。这非常有效。但它不适用于局部变量: 例如:
// Intellisense for myObject works
function MyFunc(myObject) {
/// <param name="myObject " type="MyClass"></param>
}
// Intellisense for myObject doesn't work
function MyFunc() {
/// <param name="myObject " type="MyClass"></param>
var myObject = service.GetValue();
}
// Intellisense for myObject doesn't work
function MyFunc() {
var myObject = service.GetValue();
/// <param name="myObject " type="MyClass"></param>
}
Is there a way in Visual Studio 2010 to activate Intellisense for LOCAL variables in Javascript files?
There is a MSDN How-To which explains, how to provide Intellisense for function parameters with XML comments. This works very well. But it doesn't work for local variables:
E.g:
// Intellisense for myObject works
function MyFunc(myObject) {
/// <param name="myObject " type="MyClass"></param>
}
// Intellisense for myObject doesn't work
function MyFunc() {
/// <param name="myObject " type="MyClass"></param>
var myObject = service.GetValue();
}
// Intellisense for myObject doesn't work
function MyFunc() {
var myObject = service.GetValue();
/// <param name="myObject " type="MyClass"></param>
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
VS 对于 C/C++/C# 来说非常棒,但对于 JavaScript 来说就很一般了。 :) 使用“真正的”IDE,如 WebStorm 或 Titanium Studio。
VS is awesome for C/C++/C#, but it's just mediocre for JavaScript. :) Use a "real" IDE like WebStorm, or Titanium Studio.
在第二个和第三个示例中,MyObject 是 MyFunc 的类变量,而不是函数的参数。参数符号仅适用于函数参数,因此您的符号一开始就是错误的。
以下示例将为带有参数 MyObject 的内部函数 MyFunc 提供功能齐全的 IntelliSense:
In your second and third examples MyObject is a class variable of MyFunc, not a parameter of a function. The parameter notation are for function parameters only, so your notation is wrong to begin with.
The following example will provide fully functional IntelliSense for the Internal function MyFunc with parameter MyObject: