简体   繁体   English

Visual Studio中的javascript intellisense

[英]javascript intellisense in Visual Studio

  1. How can I get JavaScript IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ? 如何在Visual Studio 2008和Visual Studio 2010中获取JavaScript IntelliSense?
  2. How can I get jQuery IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ? 如何在Visual Studio 2008和Visual Studio 2010中获取jQuery IntelliSense?
  3. If I fail to get the above, let me know 'Which is the most used JavaScript Editor which can replace VS versions for editing javascript files? 如果我没有得到上述内容,请告诉我'哪个是最常用的JavaScript编辑器可以取代VS版本来编辑javascript文件?

or you can simply drag and drop your javascript into your .js file and it creates entry like this: 或者您只需将您的javascript拖放到.js文件中,它就会创建如下条目:

/// <reference path="jquery-1.6.2.js" />

worked fine on my VS 2010 (Premium version) 在我的VS 2010(高级版)上运行良好

I'm using VS2010 with ReSharper 6 which adds powerful JS Intellisense support. 我正在使用VS2010和ReSharper 6 ,它增加了强大的JS Intellisense支持。 Autocomplete works for all JS files in the solution as well as jQuery. 自动完成适用于解决方案中的所有JS文件以及jQuery。 But it's not free. 但它不是免费的。

Go to Tools-Options-Text Editor-Javascript-Intellisense-References and place a reference to the intellisense files for the version of jquery you are using in the Implicit Web group. 转到Tools-Options-Text Editor-Javascript-Intellisense-References,并为您在Implicit Web组中使用的jquery版本的intellisense文件添加引用。

OR 要么

place an "add reference" to the intellisense file in the _references.js file which you can add to the Scripts folder of your project. 在_references.js文件中的intellisense文件中添加“添加引用”,您可以将其添加到项目的Scripts文件夹中。

/// <reference path="jquery-1.8.2.js"/>
/// <reference path="jquery-1.8.2.min.js"/>
/// <reference path="jquery-1.8.2.intellisense.js"/>

Though this will only provide intellisense for the project you are in, the first will for any open js file. 虽然这只会为您所在的项目提供智能感知,但对于任何打开的js文件都是第一个。

To get the latest jquery files with intellisense use the nuget package installer which by default will create a scripts folder and place the jquery version.js, the min.js and intellisense.js files into... from there you can copy them to the location most of the Microsoft references are placed which is typically 要使用intellisense获取最新的jquery文件,请使用nuget软件包安装程序,默认情况下将创建一个脚本文件夹,并将jquery version.js,min.js和intellisense.js文件放入...中,您可以将它们复制到位置通常是放置大多数Microsoft引用

C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\JavaScript\\References C:\\ Program Files(x86)\\ Microsoft Visual Studio 11.0 \\ JavaScript \\ References

  1. VS 2008/2010 has built in JavaScript IntelliSense. VS 2008/2010内置了JavaScript IntelliSense。
  2. If you have the corresponding "-vsdoc.js" file next to your jQuery file VS 2010 offers IntelliSense out of the box and VS 2008 needs SP1 installed and the patch at http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736 如果您的jQuery文件旁边有相应的“-vsdoc.js”文件,VS 2010提供开箱即用的智能感知,并且安装了VS 2008需要SP1和http://code.msdn.microsoft.com/KB958502/Release上的补丁/ProjectReleases.aspx?ReleaseId=1736
  3. No need, really. 没必要,真的。

You should get the jQuery files from Asp.Net CDN. 你应该从Asp.Net CDN获取jQuery文件。 They have VSDOC and are able to give very good intellisense and documentation support. 他们有VSDOC,能够提供非常好的智能感知和文档支持。

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

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