javascript console.log invalid number of arguments

In PyCharm JS files, when I try

`console.log("The value is", x)`  it warns me of "Invalid number of arguments".

There should be no warning there. That's perfectly valid for `console.log`.

 

WebStorm is FINE with this syntax, and does not show a warning.

 

How can I stop this warning in PyCharm for `console.log`?

10 comments
Comment actions Permalink

Hi,

Generally, you can Alt+Enter on any warning and select "disable inspection", which would affect only this type of inspection.

However, you're right that this is a valid expression and the warning should to be triggered. Ensure you're using the latest PyCharm version, and if the issue is still reproduced there, please provide your whole code snippet as an example.

0
Comment actions Permalink

I have the current version of PyCharm.

let x = "world.";
console.log("Hello, ", x);

I don't want to disable all complaints about Invalid Arguments for anything, of course.

It's just got the `console.log`  wrong.

 

0
Comment actions Permalink

I can't reproduce the issue in PyCharm 2019.2.3

Please run the inspection on this file, and provide screenshot with the results along with logs: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

0
Comment actions Permalink

Not seeing a way to attach the log files. 

0
Comment actions Permalink

Sorry to insist, but please either provide a full snippet where you see the error, or paste this snippet into a new file and share a screenshot:

let x = "world.";
console.log("Hello, ", x);

 

0
Comment actions Permalink

That IS the full snippet. Just those two lines. Put those, or any like them them anywhere and I see the issue.

 

 

0
Comment actions Permalink

I think I am being pretty clear. The IDE expects only one argument to console.log. Any additional vars throws the warning.

The snippet is just those two lines.

0
Comment actions Permalink

Ok. I've been asking because I can't reproduce the issue in the latest PyCharm version. Let me ask someone from WebStorm to take a look.

0
Comment actions Permalink

Hi Scott,

If you Ctrl-click on `log` where will you be navigated?

0
Comment actions Permalink

Oksana Chumak scott hill

I assume that would go to wrong definition, i.e. Math.log.
To fix:

Go to: Settings -> Languages & Frameworks ->  JavaScript -> Libraries
Then check "Node.js Core"

0

Please sign in to leave a comment.