PHPStorm can't tell which $.map is going to run? Follow
So... so I have to go through each possible reference it shows me to figure out if that's what's actually being run?
Or do I need to trace which .js file is actually being included in the page (even if not just one) to assume that's the one?
I only know that not all of them are being included/run in the browser page... but I don't know why PHPStorm is showing all possible ones it could be, as if it's completely lost on code context.
And why is it showing duplicate references?! This is so bizarre. Maybe VS Code can figure this out better?
Is there no better way to see which actual $.map function definition is going to be run?
Please sign in to leave a comment.
Which IDE version do you use? How is $ defined? A code sample and package.json would be helpful.
I'm using 2022.1.
I'm not understanding what you mean by how is dollar used. It's part of jQuery, but PHPStorm can't tell which one is being used.
See what I'm saying? Clicking the `map` function call or the `$` for it just show a crapton of jQuery/JS references... I can't actually tell what this thing is actually going to do from the editor's perspective. I have to go track down what's actually included/running on the page (if it's even set up well and not a mess), and it would be nice to know which actual function definition is going to be run, in which file, if that's even possible or feasible for the editor to do.
How is jquery added to the project? Please attach package.json.
Added to the project or added to the app? I'm not sure which you mean.
The app's package.json specifies jQuery ^3.5.0 in its "dependencies" section, but not in its "devDependencies" section (I'm not sure how this works yet). I'm not sure yet if that version of jQuery actually ends up being used in the app's execution, or if something else overrides it.
Sorry for not getting back to you earlier.
Could you please provide a complete code sample/ a sample project where the issue is reproducible?
Also, please make sure that all dynamically generated folders (for example, dist in your case) are excluded from the project (right click on the folder in the project view > Mark as > Excluded). It'll help to avoid project reindexing on flashing generated files to disk and decrease the amount of code to be indexed.
So the information I provided that you asked for is not being understood? Or where's the disconnect? I find it concerning that you ask for all this information, I provide it, and then you ask for a functioning sample project... Maybe you can tell me what information is missing that you need to make a sample project you consider adequate to work with?
I don't know how long it'll take me to create a sample project, but if you understand the info I sent you that you asked for then you should be able to create the sample project that you need to work with.
So what information is missing that you need? Or are you able to figure out the issue or create your own sample project with the info you requested that I provided?
I'll look into your suggestion.
We couldn't reproduce it using your package.json; that's why we are asking for a complete code sample as well.