I have a custom javascript called chris-vsdoc.js
Im trying to get Visual Studio 2010 intellisense to display the sayHello function
var chris = new chris();
function chris() {
this.sayHello = function (message) {
/// <summary>
/// Shows a message in a dialog box, with an OK开发者_StackOverflow社区 button.
/// </summary>
/// <param name="message">
/// message - the message to display
/// </param>
}
}
My other .js files have a reference in them list this
/// <reference path="../chris-vsdoc.js" />
Any ideas how to get intellisense working?
Is there something Im missing?
You can use virtual root (~/
) paths in the Intellisense reference directive, which has worked best for me in the past, e.g.:
/// <reference path="~/Scripts/chris-vsdoc.js" />
Also, you can mark up your actual chris.js
file with the VSDoc comments and reference that, rather than needing to have a separate VSDoc. Minification will strip out all the VSDoc information anyway since it's just a regular JavaScript comment that begins with another /
.
I usually end up with a central main.js
(named based on the project, not "main"), and then several main.namespace.js
files that eventually all get combined into one (with "main"). main.js
has a /// <reference />
to each of the main.namespace.js
files and then each of those has a single /// <reference />
back to main.js
.
Using that approach, I get correct, VSDoc-driven Intellisense for the entire group of files in any one of them.
精彩评论