编辑JS文件时的Intellisense [英] Intellisense while editing JS files

查看:116
本文介绍了编辑JS文件时的Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio中创建项目.在HTML文件中编辑JS时,由于我们已经在顶部包含了对所有JQuery文件的引用,因此我们可以对jquery实例进行智能感知.但是,当我们编辑JS文件时,根本没有任何智能感知!有没有办法在这里获得智能?

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?

推荐答案

假设您正在谈论Visual Studio,请尝试将以下行添加到.js文件的顶部.

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"/>

此外,如果您使用的不是Visual Studio附带的jQuery版本,则需要一个与您的jquery文件名匹配的jquery-x.x.x-vsdoc.js文件,并将该vsdoc放在与jQuery相同的目录中库.

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.

(例如,如果您使用的是jquery-1.5.2.min.js,则将jquery-1.5.2-vsdoc.js放在项目的同一目录中)

(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)

您可以在此页面上获取适用的vsdoc文件:

You can get the applicable vsdoc file at this page:

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

这篇关于编辑JS文件时的Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆