Intellisense while editing JS files

我是研究僧i 提交于 2019-12-13 09:37:48

问题


I am creating project in Visual Studio. While editing JS in a HTML file, since we have included the reference to all JQuery files on top, we get intellisense for jquery instances. But, when we are editing JS files, we don't get any intellisense at all! Is there any way to get intellisense there too?


回答1:


Assuming you're talking about Visual Studio, try adding the following line to the top of your .js file.

/// <reference path="~/path/to/your/jquery.js"/>

Also, if you're using anything other than the version of jQuery that was packaged with Visual Studio, you'll need a jquery-x.x.x-vsdoc.js file that matches your jquery filename, and put that vsdoc in the same directory as your jQuery library.

(For example, if you are using jquery-1.5.2.min.js, you will want jquery-1.5.2-vsdoc.js in the same directory of your project)

You can get the applicable vsdoc file at this page:

http://appendto.com/community/jquery-vsdoc




回答2:


You seem to be implying that you are using Visual Studio to edit your JS files. If so, perhaps the JScript Editor Extensions extension for VS would work for you. It adds support for Intellisense inside JS files.



来源:https://stackoverflow.com/questions/8852395/intellisense-while-editing-js-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!