简体   繁体   English

参考javascript文件以使用Visual Studio 2010智能感知

[英]Reference javascript files to use visual studio 2010 intellisense

I have a website with very heavy (long javascript > 100KB + JQuery). 我的网站内容非常繁重(长javascript> 100KB + JQuery)。 So, for making the javascript re-useable, I want to separate the logic in different javascript files. 因此,为了使javascript可重用,我想将逻辑分离到不同的javascript文件中。

So, I want to make an aggregated javascript file 所以,我想制作一个汇总的javascript文件

在此处输入图片说明

Please tell me how (I even want to use the VS2010 intellisense in my main JS file about the functions of the other JS files.) 请告诉我如何操作(我什至想在我的主JS文件中使用VS2010 intellisense来了解其他JS文件的功能。)

Javascript Intellisense tends to be extremely unreliable as some updates broke it some updates fixed it, and there are a lot of extensions around it, breaking each other. Javascript Intellisense趋向于极其不可靠,因为某些更新破坏了它,一些更新修复了它,并且围绕它有很多扩展,彼此破坏。

Still there is a /// <reference> element for cases like this. 对于这种情况,仍然有一个/// <reference>元素。

See MSDN article and add line: 参见MSDN文章并添加以下行:

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

at the top of your script file. 在脚本文件的顶部。

Try to test it with the jQuery vsdoc and your other script files. 尝试使用jQuery vsdoc和其他脚本文件对其进行测试。

Also installing MVC4 installed some dependency or whatever that more-or-less fixed javascript intellisense for me. 另外安装MVC4会安装一些依赖项,或者对我来说或多或少固定的javascript intellisense。

我会推荐Resharper: http : //www.jetbrains.com/resharper/whatsnew/

You can separate your Javascript files and use SquishIt to concatinate and compress/minify them all into one single file to reduce the file size and the number of requests. 您可以分离Javascript文件,并使用SquishIt将它们合并并压缩/最小化为一个文件,以减小文件大小和请求数量。

I don´t know of any solution that allows you to work in both the concatinated file as well as each separated file ...and I don´t understand why anyone would want to. 我不知道有什么解决方案可让您在合并文件和每个分隔文件中工作……而且我也不明白为什么有人会这样做。

IMO, Visual Studio has a quite poor intellisense for Javascript. IMO,Visual Studio对Java的理解很差。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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