VS2008 jQuery Intellisense 不工作 - (jquery-1.4.1.js)

发布于 2024-08-22 13:12:24 字数 440 浏览 4 评论 0原文

我在谷歌上搜索过,遵循 scottguthrie 的文章&也在这里寻求解决方案,但无济于事。我的环境由 VS2008 SP1 组成,包括 JQuery intellisense 的修补程序。

我已经下载了“jquery-1.4.1.js”&还有来自 jquery 网站的“jquery-1.4.1-vsdoc.js”。 在“HTM”文件中引用它,如下所示:

<script src="Js/jquery-1.4.1.js" type="text/javascript"></script>

当我编写如下代码时,没有智能感知。

<script type="text/javascript">     
  $
</script>

有什么想法吗? TIA

I have searched on google, followed scottguthrie's article & also here on SO for a solution but to no avail. My environment consists of VS2008 SP1, including hotfix for JQuery intellisense.

I have downloaded 'jquery-1.4.1.js' & also 'jquery-1.4.1-vsdoc.js' from the jquery website.
Referenced it in an 'HTM' file like this:

<script src="Js/jquery-1.4.1.js" type="text/javascript"></script>

and when i write code like below, there is no intellisense.

<script type="text/javascript">     
  $
</script>

Any ideas? TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自由如风 2024-08-29 13:12:24

在脚本标记中,按 CTRL-SHIFT-J。观察状态栏上的消息,例如“更新 js intellisense”,

然后查看错误列表并确保没有错误。

VS 实际上解析所有引用的 javascript,有效地编译它,以生成智能感知。

如果 JS 出现错误,智能感知就会被破坏。事情就是这样。它以严厉的爱鼓励干净的代码。

jQuery 是臭名昭著的智能感知破坏源。通过关闭所有文档来获取基线,创建一个新的 html,引用 jquery,确保 vsdoc 文件具有相同的名称 + -vsdoc 并且位于同一目录中。按 CTRL-SHIFT-J 并确保没有错误影响智能感知。

然后开始添加脚本。

祝你好运。

while in your script tag, press CTRL-SHIFT-J. Watch the status bar for messages e.g. 'updateing js intellisense'

Then look at your Errors List and make sure there were no errors.

VS actually parses all the referenced javascript, effectively compiling it, to generate intellisense.

If there are errors in the JS, intellisense is broken. That is just the way it is. It encourages clean code with tough love.

jQuery is a notorious source of intellisense breakage. Get a baseline by closing all documents, create a new html, reference jquery, ensure the vsdoc file has the same name + -vsdoc and that it is in the same directory. Press CTRL-SHIFT-J and ensure no errors have borked intellisense.

Then start adding your scripts.

Good luck.

想念有你 2024-08-29 13:12:24

作品!原来是VS2008 SP1的问题,我不知道为什么,但重新安装后,智能感知可以工作。

Works! It turns out to be an issue with VS2008 SP1, i have no idea why but after re-installing it, intellisense works.

芯好空 2024-08-29 13:12:24

@BhejaFry 您只重新安装了 SP1 还是整个 Visual Studio?

我有完全相同的问题 - 智能感知适用于 .js 文件,但不适用于 .aspx 或 .ascx。我使用 hack:

<% if(false)
 {%>
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.js"></script>
    <%
 }%>

但在我通常使用脚本的文件中,我也没有得到智能感知。当然我有 htofix 和 -vsdoc。 id 似乎没有帮助。

@BhejaFry Did you reinstall only the SP1 or entire Visual Studio?

I have the exact same problem - intellisense works in .js files but it doesn't work for .aspx or .ascx. I use the hack:

<% if(false)
 {%>
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.js"></script>
    <%
 }%>

But also in files that I use the script normally I don't get intellisense. Of course I have the htofix and -vsdoc. Id doesn't seem to help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文