How to get jQuery intellisense in Visual Studio 2019
Asked Answered
S

2

8

I am trying to get jQuery intellisense working in Visual Studio.

I am using the latest jQuery version jquery-3.3.1.js and latest Bootstrap v4.3.1. I have tried every solution on Stack Overflow but nothing has yet worked for me.

I tried to reference jquery-3.3.1.intellisense.js but nothing happened. I also tried installing jQuery typed script and then adding jsconfig.json and referencing the jQuery typed script in it but unfortunately again nothing happened.

To be clear, I expect intellisense to work when I type $.

Subcontract answered 16/4, 2019 at 9:25 Comment(2)
Javascript intellisense in VS is absolutely dreadful. Admittedly I haven't yet tried VS2019, but given all my previous experience I'd abandon hope of this ever working properly.Hierarchize
thanks but i hope someone will come up with a solution.@RoryMcCrossanSubcontract
A
6

This is what worked for me:

  1. Added a Scripts folder to my solution,

  2. Added a file '_references.js',

  3. Added my reference statements to jQuery (I should upgrade jQuery, huh) in there:

    ///<reference path="jquery-1.10.2.js" />
    ///<reference path="jquery-1.10.2.intellisense.js" />
    
  4. Closed/Re-opened my solution and presto:

IntelliSense now showing jQuery usage

Here is some back story: https://www.madskristensen.net/blog/the-story-behind-_referencesjs/

Abdulabdulla answered 7/2, 2020 at 15:41 Comment(4)
thanks a lot, the article you referenced give me more understanding of the issue. I didn't try the solution because VS2019 solved the problem and now I can use IntelliSense for jquery, but your solution would work perfectly because that what visual studio use for IntelliSense.Subcontract
why this keeps happening? Sometimes when I install some client libraries my IntelliSense stops working. Is there any log that I can check ?Dekow
I have this problem occasionally, too. I haven't quite figured it out yet. I usually test IntelliSenese whenever I add some new typings and back stuff out when it does not work. I haven't yet (or looked very hard) for logging that might explain where the conflicts are coming from.Abdulabdulla
Intellisense works but syntax highlighting is not, jQuery code all plain white(Gelb
W
1

just install this jQuery-vsdoc from nuget and it works Intellisense Working in Visual Studio 2022 in Dot Net Core Project

Wimsatt answered 10/9, 2022 at 17:45 Comment(2)
Doesn't work in VS2022 17.4. No manual at all but seems this plugin just has to add a menu to add _references.js explained above. It doesn't anyway.Gelb
I got version 2.1.0 and all working good.Ideologist

© 2022 - 2024 — McMap. All rights reserved.