PHPStorm can't tell which $.map is going to run?

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?

Comment actions Permalink

Which IDE version do you use? How is $ defined? A code sample and package.json would be helpful.

Comment actions Permalink

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.

Comment actions Permalink

How is jquery added to the project? Please attach package.json.

Comment actions Permalink

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.

"name": "[redacted]",
"version": "1.0.0",
"main": "index.js",
"repository": "[redacted]/[redacted]",
"author": "[redacted] <[redacted]>",
"license": "none",
"private": true,
"dependencies": {
"babel-polyfill": "^6.26.0",
"extract-text-webpack-plugin": "^3.0.2",
"jquery": "^3.5.0",
"moment": "^2.20.1",
"path": "^0.12.7",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-paginate": "^5.0.0",
"react-select": "^1.1.0",
"underscore": "^1.8.3"
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.7",
"style-loader": "^0.19.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.9.7"
"scripts": {
"start": "webpack-dev-server",
"watch": "webpack -w",
"build": "webpack -p"

Please sign in to leave a comment.