Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellisense doesn't work for JavaScript in Visual Studio 2012

I have a clean, out-of-the-box installation of Visual Studio 2012 Web Developer Express and for some reason the support for JavaScript (both jQuery, jQuery UI and other libraries) has disappeared. I believe it worked before and then for "no reason" it stopped.

I've browsed the web as supposed to and discovered four discrepancies.

  1. I don't have the key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\JavaScriptLanguageService\ImplicitReferences in my registry. In fact, I don't even have JavaScriptLanguageService directory.

  2. I've checked that the referred file domWindows.js indeed is where the options point to.

  3. The output window under JavaScriptLanguageService is empty and nothing is being typed there while I develop and run my application.

  4. I've referred to the jQuery-file that I'm using through the options but it didn't produce any changes.

All in all I get the error message saying that:

"intellisense was unable to determine an accurate completion list for this expression, The provided list contains all identifiers in the file"

Any suggestions would be warmly appreciated.

like image 947
Konrad Viltersten Avatar asked Jul 14 '12 23:07

Konrad Viltersten


People also ask

How do I enable IntelliSense in Visual Studio?

To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.

How do I enable IntelliSense in Visual Studio 2010?

1) Use the Tools->Options menu command, select the Text Editor->C# settings, and then check the two circled check boxes above (Auto-list members and Parameter information). IntelliSense will then be turned on and work fine.


2 Answers

Kudos to CraigTP

Summary:

  1. navigate to the [Tools] > [Options] > Text Editor > JavaScript > IntelliSense > References options

  2. select Implicit (Web)

    you can find "~/Scripts/_references.js" (if you want to put it in different place, change it here)

  3. go to ~/Scripts and add new item "_references.js"

  4. add /// <reference path="path\jquery-1.7.1.js" /> in "_references.js"

    or /// <reference path="~\root\path\jquery-1.7.1.js" />

Happy coding :)

Edit note:

Remember to put jquery-1.7.1-vsdoc.js in the same folder with jquery-1.7.1.js

After making above mentioned changes, if it is still not working try restarting visual studio.

like image 160
maxisam Avatar answered Sep 23 '22 03:09

maxisam


Go to menu Tools -> Options -> Text Editor -> JavaScript -> Intellisense -> References and place a reference to the intellisense files for the version of jQuery you are using in the Implicit Web group.

Enter image description here

OR

place an "add reference" to the intellisense file in the _references.js file which you can add to the Scripts folder of your project.

/// <reference path="jquery-1.8.2.js"/> /// <reference path="jquery-1.8.2.min.js"/> /// <reference path="jquery-1.8.2.intellisense.js"/> 

Though this will only provide intellisense for the project you are in, the first will for any open JavaScript file, not just the ones in the project you are in.

To get the latest jQuery files with intellisense use the NuGet package installer which by default will create a scripts folder and place the jQuery version.js, the min.js and intellisense.js files into... From there you can copy them to the location most of the Microsoft references are placed in, which is typically:

install-package jquery in the package manager console.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References

like image 23
DRobertE Avatar answered Sep 23 '22 03:09

DRobertE