False Error Reporting on JavaScript Strings

Why does WebStorm/PhpStorm report the following JavaScript variable declaration as an error:

var labelOpen = '<label for="remove-search-';

error.jpg

The variable will be combined with labelClose to complete the string.

But as you can see in the image, PhpStorm reports an error and oblierates the entire interface with hundreds of reported errors.

Besides disabling Inspections or switching to a different IDE, is there a way to correct this obnoxious behavior?

1 comment
Comment actions Permalink

Hi there,

As you can see the string has different background. That's because of automatic Language Injection feature -- it detected that the string looks like HTML and treats it as such (provides syntax highlighting, code completion, inspections/validation etc). Because fragment is not completed/valid in any way (missing closing double quote, closing > etc), it somehow produces all this noise (cannot explain or confirm more than this without checking the actual file myself).

Go to Settings | Language Injections and disable entry for HTML

0

Please sign in to leave a comment.