Intellisense doesn't work for JavaScript in Visual Studio 2012

JqueryVisual StudioIntellisenseVisual Studio-2012Javascript Intellisense

Jquery Problem Overview


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.

Jquery Solutions


Solution 1 - Jquery

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.

Solution 2 - Jquery

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

Solution 3 - Jquery

Summary:

  1. Drag the .js file you want to reference from Solution Explorer into your current one. (Visual studio will create a reference snippet.)

Solution 4 - Jquery

Try adding them to your implicit JavaScript references. This is located at Tools -> Options -> Text Editor -> JavaScript -> IntelliSense -> References.

Solution 5 - Jquery

To add jQuery and its intellisense files to an active/opened project/website

In Visual Studio 2012, do the following:

Open menu Tools -> Library Packet Manager -> Manage Nuget packages for solution. Click the Online field/selector in the very right side of the dialog box. Find jQuery in the middle list, click it, and click Install.

Observe that the jQuery script files are now inserted into your project by looking at the Solution Explorer panel. You should see jquery-1.x.x.js (where x here is are placeholders for the actual version numbers. Say jquery-1.9.0.js is a concrete example).

Also, observe that there is now a Jquery-1.9.0.intellisense.js file there. Neat ai? :-)

But bear in mind, that if you create a new website in Visual Studio and choose ASP:NET Web forms site (as opposed to an Empty site) the web forms site will already have jQuery 1.7.1 in there).

Solution 6 - Jquery

I included jquery-xxx.intellisense.js in JavaScript -> Intellisense -> Reference. It worked one time, but after I closed Visual Studio and restarted it, intellisense didn't work again. But I accidentally hit menu Edit -> intellisense -> Refresh Remote References. It worked again. Try that!

Solution 7 - Jquery

Use NuGet IntelliSense documentation package for JQuery by installing it like this from the NuGet console:

Install-Package jQuery-vsdoc

After you install the package go to:

Tools>>Options>>Text Editor>>JavaScript>>Intellisense>>References

and Add reference to Implicit(Web) group by selecting the installed package location on your hard drive.

restart Visual Studio, and you will get the jQuery intellisense working.

Solution 8 - Jquery

What ended up working for me was to reorder the list in _references.js. I had almost 150 lines in there due to a bunch of plugins imported into the project, and jQuery was near the bottom. When I moved its reference to the top, my intellisense started working again.

What it looks like:

/// <autosync enabled="true" />
/// <reference path="jquery-2.1.3.js" />
/// <reference path="jquery-ui-1.11.2.js" />
/// <reference path="modernizr-2.8.3.js" />
... more reference lines

Note the reference is to the jquery-{version}.js file. There is also a file installed with the Nuget package in the same directory named jquery-{version}.intelliense.js, which I assume is what is used. Hope that helps.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKonrad VilterstenView Question on Stackoverflow
Solution 1 - JquerymaxisamView Answer on Stackoverflow
Solution 2 - JqueryDRobertEView Answer on Stackoverflow
Solution 3 - JqueryJamesView Answer on Stackoverflow
Solution 4 - JqueryscottheckelView Answer on Stackoverflow
Solution 5 - JquerynetfedView Answer on Stackoverflow
Solution 6 - JqueryTrio CheungView Answer on Stackoverflow
Solution 7 - JqueryAshraf SadaView Answer on Stackoverflow
Solution 8 - JqueryNoah StahlView Answer on Stackoverflow