简体   繁体   中英

How can I make Visual Studio display inline documentation for built-in JavaScript?

In Visual Studio 2010 and 2012, the JavaScript editor supports displaying inline documentation for JavaScript things such as functions. However, Visual Studio didn't appear to ship with this documentation for JavaScript's own built-in parts.

Here's a specific example of what I want to achieve. If I access a String 's charAt method, here's what currently happens:

Visual Studio显示返回和参数类型,但不显示文档。

For built-in .NET classes, Visual Studio provides documentation. I would like to have the same thing for JavaScript.

Regarding how to do this, I think it could be done by providing a JavaScript file that contains stubs documented using JsDoc or VsDoc. Then I could just tell Visual Studio to use it as a reference for IntelliSense. Unfortunately, I couldn't find any existing work that already did this.

In VS2012, you can create a JavaScript file with all your VSDoc documentation and then save it as a reference file.

To configure a reference file:

  1. Select TOOLS > Options from the main menu bar
  2. Navigate to Text Editor > JavaScript > IntelliSense > References
  3. Select Implicit (Web) from the Reference Group drop-down list
  4. Locate your file and then click Add

In VS12, the magic file you need is ~/Scripts/_reference.js

Place lines like this, substituting the correct path, of course.

It should pick up the jQuery VSDOC if it is there.

/// <reference path="~/Scripts/Frameworks/Kendo/kendo.web.exploded.js"/>
/// <reference path="~/Scripts/Frameworks/jQuery/jquery.1.8.2.js"/>
/// <reference path="~/Scripts/kendoize/kendoize.js" />
/// <reference path="~/Scripts/kendoize/validation.js" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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