PhpStorm not recognizing all of jQuery?
I'm in the process of trying to clean up my code, getting rid of all of the little warnings and notices that PhpStorm is throwing at me, such as changing "var" to "let" or "const".
I've run into one odd problem that leaves me puzzled. I have jQuery installed in this project and PhpStorm does appear to recognize its methods, except for a couple of them:
I don't know why PhpStorm isn't recognizing any "$." jQuery directives. It can clearly handle its other ones, as you can see in the first few lines of the above code. Can anyone please explain to me why this is happening and, more importantly, how to correct it?
请先登录再写评论。
Hello,
Please try to run File > Invalidate Caches/Restart > Invalidate and Restart and check how it will go afterwards.
if invalidating caches doesn't help, please try Ctrl+clicking on highlighted `$` - what file/definition are you taken to?
Thanks for replying back, @Vladimir and @Elena.
Unfortunately, invalidating the caches and restarting did nothing for this issue. Cmd-Clicking on the `$` yielded plenty of options, none of which were plain jQuery:
So, you have `$` defined in multiple libraries, and the IDE is confused; moreover, seems the jquery library itself can't be found - do you have it configured? Adding Typescript stubs (`npm i @types/jquery`) is the best way to go
Still no help. I'm afraid. It just adds one more entry to the list, which still isn't jQuery:
And this is after another "invalidate/restart" sequence, too. I know for a fact that jQuery is being loaded; it's just in a PHP Blade partial that contains all of my JavaScript loads. It ultimately is added to the bottom of the constructed HTML page, before the custom JS file which contains all the jQuery calls. I guess all of this routing is a little too much for PhpStorm to understand, so it only gets _part_ of the jQuery commands; specifically, the ones that are called with a `$.` instead of just `$` (as can be seen in the `datepicker` line near the top of the screenshot).
To be honest, this isn't a huge problem. The code executes as expected; I just was wanting to get rid of any warning "squigglies" that the IDE was throwing at me. If it cannot be removed, I'll be fine. :~)
Hi, I have the same problem, and I need to fix it, because my code dosn't work. I use the same plugin of you, Chris McGee.
I think datatables erase the definition of jQuery ..
If you have found the solution, please tell me !
thanks
Please submit a support ticket, that would you with timely updates and also would give you an opportunity to share your logs / projects / whatever is needed for issue troubleshooting.
https://intellij-support.jetbrains.com/hc/en-us