简体   繁体   中英

ASP.NET MVC3 & JavaScript: How to get Intellisense on functions & variables located in other JS files

I'm using ASP.NET MVC 3 and I have one JavaScript-file for each view and each partial view. So if I have the following files:

User.cshtml
User.js
_EditUser.cshtml
_EditUser.js

Now, I want to have intellisense in file '_EditUser.js' for functions and variables defined in 'User.js'. Is that possible?

Try to add

/// <reference path="User.js" />

to the top of _EditUser.js

Update: To see more than names of variables and functions of User.js you need to add special comments with tags. They are like usual comments for documenting C# code in Visual Studio. One of minor differences is this comments are inside function body not before. You can see it in jQuery-with-doc-file as you mentioned in comment.

function Some(key, value)
{
   /// <summary>Function do some value with key</summary>
   /// <param name="key" type="String">Key argument</param>
   /// ... and so on ...

}

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