添加其他js文件会破坏jQuery IntelliSense [英] Adding additional js files breaks jQuery IntelliSense

查看:95
本文介绍了添加其他js文件会破坏jQuery IntelliSense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在VS2008中使用jQuery IntelliSense,它很棒.最近,我添加了对jQuery UI的引用,从那时起,jQuery IntelliSense消失了.我发现,一旦您在文档中引用了另一个.js文件,IntelliSense就会消失.有什么办法可以避免这种情况?

I have been using jQuery IntelliSense in VS2008 and it has been great. Recently I added a reference to jQuery UI and since then, the jQuery IntelliSense has went away. I found that once you reference another .js file in your document, the IntelliSense goes away. Any way to avoid this?

推荐答案

如果所引用的文件中有错误,则它将破坏同一文档中所有文件引用的智能感知.在这方面,Visual Studio的下一版本将更加强大.对于这种脆弱性,我直接表示歉意.我们很早就做出了一些设计决策,以免我们无法使VS9外部引用更可靠.

If there are errors in any refernced files it will break intellisense for all files references from the same document. The next version of Visual Studio is going to be much more robust in this respect. I apologize directly for this fragility. We made some design decisions early on that we prevented us from making VS9 external references more robust.

同时,使用以下解决方法.从链接Slace给您安装SP1.如果您有一个名为.js的引用文件,并且在同一位置有一个名为-vsdoc.js的文件,则JS intellisense将使用-vsdoc版本.如果该脚本为空,则不会生成错误.确定导致智能感知生成失败的jquery插件,并在其旁边放置-vsdoc版本.您将不会获得UI的智能感知,但仍然会得到jquery和其他有效的插件.

In the meantime, use the following workaround. Install SP1 from the link Slace gave you. If you have a reference a file named .js and there is a file named -vsdoc.js in the same location, then JS intellisense will pick up the -vsdoc version. If that script is empty then it won't generate an error. Identify the jquery plugin that is causing intellisense generation to fail and place a -vsdoc version next to it. You won't get intellisense for UI, but you will still get jquery and other plugins that do work.

您在vsdoc版本中放入的所有内容都将显示在intellisense中.如果需要,可以将要显示的欺骗性数据结构版本放入智能感知中.

Anything you put in the vsdoc version will show up in intellisense. You could put spoofed versions of the data structures that you want to display in intellisense if you want to.

这篇关于添加其他js文件会破坏jQuery IntelliSense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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