none
no javascript intellisense in a particular web application (VS2015)

    Question

  • In one of my solutions, I have a class library project and two web applications. In the web applications, on the .cshtml pages, I have Razor intellisense, but absolutely nothing for Javascript. If I type "$." and hit ctrl+space, nothing happens. no popups. This is very frustrating because I am not all that familiar with JS! HOWEVER, in a different solution with a web app, I *do* have javascript intellisense. This makes me think it is not Visual Studio that is broken. It's something about this particular solution. 

    I have tried every answer I can find on StackOverflow. Especially everyone's favorite,  adding the /Scripts/_reference.js file to the Tools | Options | Code Editor | Javascript | Intellisense setting. That does not help. I have tried downgrading jQuery from 3.1.1 to 2, the same version used in the solution that works. I have tried editing the _reference.js file to have fewer items. I have disabled Resharper. I have unloaded and reloaded the project. I have restarted VS. I have not reset the settings of VS because that would be too chaotic, and since it works in other projects, i don't want to.

    What I need is someone who understands how Visual Studio determines how to display intellisense to give me a checklist of things that need to be in place for it to work. The key clue here is why would one project work properly but another doesnt?  Any help would be appreciated! Thanks!

    Wednesday, February 01, 2017 6:24 PM

Answers

  • 2. Add a new web application, then add a new .cshtml file under this new web application and check

    I took this to mean add a new application to the broken solution, so I did that. JS Intellisense works in this new project! This was a great thing to try. It began with JQuery 1.x and I upgraded to 3.1.1 to match the other projects. This weakened the quality of the intellisense, giving only a minimal amount of information. I took a peek in _references.js and noticed that only the jquery.min.* and jquery.slim.* files existed. I removed those references and changed it to the jquery-3.1.1.js file. So my ~/Scripts/_references.js looks like this:

    /// <autosync enabled="true" />
    /// <reference path="jquery-3.1.1.js" />
    /// <reference path="bootstrap.js" />
    /// <reference path="jquery.validate.js" />
    /// <reference path="jquery.validate.unobtrusive.js" />
    /// <reference path="modernizr-2.6.2.js" />
    /// <reference path="respond.js" />

    This greatly improved the quality of the JS intellisense, because it's not using the minified versions, and it is reading from the jquery-3.1.1.intellisense.js file as well. 

    BUT! What about my other projects? I copied the above _references.js code and pasted that into the _references.js in the broken projects. It works! Yay! But why?

    I started removing individual lines from the broken _references.js file. It didn't take me long to find the culprit.

    /// <reference path="jquery-ui-1.11.4.js" />

    This reference broke all my javascript intellisense. Removing it fixed my problem. Thank you Sara for your help troubleshooting this! 

    • Marked as answer by redwards510 Thursday, February 02, 2017 5:29 PM
    Thursday, February 02, 2017 5:29 PM

All replies

  • Hi redwards510,

    Welcome to the MSDN forum.

    Refer to your description, this issue only happens in this solution. We need to check if this issue existing for all .cshtml files among this solution or not, please have a look at the following to troubleshot: (Back up the solution before any modification, in case we need to roll back. )

    1. Add a new .cshtml file under the same web page or another web page project to test the intellisense

    2. Add a new web application, then add a new .cshtml file under this new web application and check

    3. Remove the class library project and web application project one by one to check if the other project affects this issue

    Meanwhile, you can try the following methods which usually work for the intellisense not working issue:

    1. Delete the .suo or .vs file under your solution folder, the .vs folder might be hidden, restart VS and reopen this solution to check this issue again.

    2. In your _references.js file, ‘autosync’ is ‘false’, the default value is ‘true’, you can also modify it and clean up the solution, rebuild it, then test the intellisense again

    3. Right click the .cshtml file an choose ‘Open with…’ and it should be ‘HTML Editor (Default)’.

    4. Try to open an administrative CMD window and navigate to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE and run the commands: devenv /resetuserdata to clean up the old user data. 5. Delete or rename the folders: C:\Users\<your users name>\AppData\Local\Microsoft\VisualStudio\14.0 and C:\Users\<your users name>\AppData\Roaming\Microsoft\VisualStudio\14.0 to clean up the cache data.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, February 02, 2017 6:22 AM
    Moderator
  • 2. Add a new web application, then add a new .cshtml file under this new web application and check

    I took this to mean add a new application to the broken solution, so I did that. JS Intellisense works in this new project! This was a great thing to try. It began with JQuery 1.x and I upgraded to 3.1.1 to match the other projects. This weakened the quality of the intellisense, giving only a minimal amount of information. I took a peek in _references.js and noticed that only the jquery.min.* and jquery.slim.* files existed. I removed those references and changed it to the jquery-3.1.1.js file. So my ~/Scripts/_references.js looks like this:

    /// <autosync enabled="true" />
    /// <reference path="jquery-3.1.1.js" />
    /// <reference path="bootstrap.js" />
    /// <reference path="jquery.validate.js" />
    /// <reference path="jquery.validate.unobtrusive.js" />
    /// <reference path="modernizr-2.6.2.js" />
    /// <reference path="respond.js" />

    This greatly improved the quality of the JS intellisense, because it's not using the minified versions, and it is reading from the jquery-3.1.1.intellisense.js file as well. 

    BUT! What about my other projects? I copied the above _references.js code and pasted that into the _references.js in the broken projects. It works! Yay! But why?

    I started removing individual lines from the broken _references.js file. It didn't take me long to find the culprit.

    /// <reference path="jquery-ui-1.11.4.js" />

    This reference broke all my javascript intellisense. Removing it fixed my problem. Thank you Sara for your help troubleshooting this! 

    • Marked as answer by redwards510 Thursday, February 02, 2017 5:29 PM
    Thursday, February 02, 2017 5:29 PM
  • Hi redwards510,

    It's my pleasure to help you and thank you for your sharing, it will help other community members:)

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 06, 2017 1:28 AM
    Moderator