18

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:

I'd post an image but as a new user it won't let me. enter image description here

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

EL MOJO
  • 783
  • 1
  • 9
  • 22
  • I know it sucks, but have you tried reinstalling/repairing VS? I've had some very odd issues resolved that way. if what works for most people doesn't work for you, thats a good indication its time to give it a try. also you may want to try it with no addnos loaded, just to eliminate that possibility. sometimes code-assistance addons in particular do weird things to intellisense. – Frank Thomas Nov 02 '12 at 23:37
  • Thanks for your input Big Hurt. I tried uninstalling and reinstalling VS2012. I don't think I got a clean reinstall because when I opened VS2012 after the reinstall, all my settings were the same as before the uninstall (i.e. my IDE was configured in my custom way). – EL MOJO Nov 03 '12 at 16:41
  • can you show/tell us how you place the js files? – Ray Cheng Nov 04 '12 at 00:20
  • They are in a legacy project (pre VS2012) and reside in a folder called "Scripts". I can't believe the file structure is the issue because the Intellisense resolves correctly for the project/file on a separate computer. – EL MOJO Nov 05 '12 at 19:42
  • VS2013 here. Restart fixed it for me. (ASP.NET MVC 4 project) – Daniel Szabo Dec 17 '14 at 05:33

6 Answers6

21

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.

Community
  • 1
  • 1
firepol
  • 1,731
  • 22
  • 39
  • I am still having issues with VS 2012, at least minimally. Ive followed many of the threads here and have html and basic angularjs intellisense working, but there are still some things that just arent getting seen and visual studio still seems confused, or maybe im confused. http://stackoverflow.com/questions/29477583/vs-2012-javascript-intellisense-for-angular-still-getting-warnings – bitshift Apr 06 '15 at 19:31
  • @bitshift since a while you can get Visual Studio 2013 Community edition, for FREE. Time to upgrade? https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx Read Q&A: as individual developer: it's free. In a little company, max. 5 users can get it. In a big (enterprise) company with more than 250 PCs and more than 1M revenue/year you may ask your boss ;) – firepol Apr 08 '15 at 06:32
3

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.

Ray Cheng
  • 12,230
  • 14
  • 74
  • 137
  • Thanks Ray, I'll try this and let you know. – EL MOJO Nov 03 '12 at 21:31
  • I tried all the options you've suggested Ray. I cannot due step 4 because I don't have another developer. The project opens fine and is able to do the proper JS Intellisense within it on my laptop. So the problem must lie somewhere on my desktop PC. I tried uninstalling and reinstalling VS2012. I don't think I got a clean reinstall because when I opened VS2012 after the reinstall, all my settings were the same as before the uninstall (i.e. my IDE was configured in my custom way). – EL MOJO Nov 05 '12 at 19:39
  • if you reset your IDE prior or after reinstall, your customized setting should be gone. also, you may also try to uninstall all the third party tools under TOOLS -> Extensions... sometimes, those cause problems too. – Ray Cheng Nov 05 '12 at 21:38
2

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

Warren
  • 384
  • 4
  • 17
0

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.

Steve Mannina
  • 475
  • 3
  • 11
  • Steve, I tried as you've suggested but this did not work. Thanks for you input. – EL MOJO Nov 03 '12 at 16:47
  • Just to make sure it is not the code, try this: var d = new Date(); d. Do you see the methods for Date? If not, does Ctrl, Shift J show the methods? – Steve Mannina Nov 14 '12 at 04:31
0

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']);

starbugs
  • 635
  • 1
  • 6
  • 10
0

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

vineel
  • 3,483
  • 2
  • 29
  • 33