Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
786 views
in Technique[技术] by (71.8m points)

visual studio 2010 - How to reference multiple files for javascript IntelliSense in VS2010

I have large solution with about 40 separate javascript files, which are referenced to web page via special js-service. I want to use new IntelliSense features in VS2010, but it is very hard to add about 40 individual references like this:

/// <reference path="../../lib/jquery-1.3.2.js" />

to each js file in solution. Maybe there is some way to reference all files in folder? I've tried something like this:

/// <reference path="../../lib/*.*" />

but it is not working... Thanks.

Update: Maybe there are some add-in, which could help with this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Add the references to one js file, ideally one that all the others rely on or use. Then everywhere else, include a reference to just that one js file.

ie, file1.js contains:

/// <reference path="file2.js" />
/// <reference path="file3.js" />
...
/// <reference path="file40.js" />

And every other file contains just one reference:

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

Update for Visual Studio 2012: You can now put global references in the _references.js file so that intellisense is available automatically in other js files. You can also specify intellisense files in the tools dialog under "Tools" > "Options" > "Text Editor" > "JavaScript" > "Intellisense" > "References".

More detail in this blog post: JavaScript Intellisense in VS 2012, The _references.js File


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...