Visual Studio 2012 JavaScript Intellisense Not Working

狂风中的少年 提交于 2019-11-30 00:46:05

问题


I have Visual Studio 2012 installed on my laptop and desktop. On my desktop PC, the JavaScript intellisense is not working. For any method it pulls up (even standard JavaScript calls) I receive the message, "Intellisense was unable to determine an accurate completion list for this expression".

I've tried all of the suggestions from the other posts and tried everything I could find on Google. Nothing has worked. It isn't about not having JQuery Intellisense. I don't get even basic JavaScript Intellisense.

Edit:

The objects in the above images are simple strings, yet I don't get any help from the Intellisense.


回答1:


I had the same problem: in Visual Studio 2010 I was used to add a reference in my javascript files, at the top, like this:

/// <reference path="/scripts/jquery-1.7.1-vsdoc.js" />

With the new Visual Studio 2012 this was not working anymore, I looked around and found the solution to put the reference in /scripts/_references.js I did so, not working.

What I was doing wrong was that I was referencing the vsdoc.js file, or at the moment of writing, nuget downloaded jquery 1.9.1 package, reference to jquery-1.9.1.intellisense.js which is WRONG.

The correct reference (if using the /scripts/_references.js file) is:

/// <reference path="/scripts/jquery-1.9.1.js" />

(NOT the .intellisense.js or the -vsdoc.js file).

For the global solution to work on all your projects: copy all the jquery files (main, minified, map, and intellisense one, to be sure) in C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References (adapt the path if you installed Visual Studio 2012 somewhere else) and in Visual Studio, under Tools > Options > Text Editor > Javascript > Intellisense > References > Add a reference to jquery-1.9.1.js (again, NOT the vsdoc or intellisense file, but the main one) as explained in the solution by denas (but it was not clearly said not to point the vsdoc/intellisense file).

Hope this helps.




回答2:


Many things can cause problems like this, but I usually follow these steps to troubleshoot it.

  1. close visual studio and restart
  2. reboot windows and start visual studio again
  3. have another developer load your project and test it
  4. create a bare bone project and test with all stock javascript references
  5. reset IDE
  6. run VS in safe mode and test your project
  7. uninstall and reinstall vs

I usually resolve most of the VS problems at step 3 or 4, and sometimes 5.




回答3:


If you've installed VS on anything other than the C Drive this will happen.

In Visual Studio, under Tools > Options > Text Editor > Javascript > Intellisense > References

Add references to the same .js files that exist in the list but pointing to the new path where you have VS installed

eg - G:\Program Files\Microsoft Visual Studio 11.0\JavaScript\References.libhelp.js

There are 5 of them

After this go to Edit> Intellisense > Refresh external references




回答4:


I fixed the same problem by right-clicking the file in Solution Explorer and choosing Open With and then choosing Web Form Editor if you're editing a Web form or Source Code (Text) Editor if you're editing a JavaScript file.




回答5:


In visual studio 2012,
Using this solution https://github.com/jmbledsoe/angularjs-visualstudio-intellisense.

Make sure put ng, ngCookies modules into required fields. For example: var module = angular.module("demo", ['ng','ngCookies']);




回答6:


An excellent article by Mads Kristensen helped me fix the JavaScript Intellisense issue.

Triple-slash references look like this and can be added to the top of any .js file or in /scripts/_references.js file

/// <reference path="../app/respond.js" />

REF: http://madskristensen.net/post/the-story-behind-_referencesjs



来源:https://stackoverflow.com/questions/13204428/visual-studio-2012-javascript-intellisense-not-working

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