Major syntax detection bug

PhpStorm, for some reason, does not like this:

<div id="mydiv"></div>

It reports that "Selector matches unknown element mydiv". And if I click on the exclamation point, it offers to correct it to #mydiv which is completely invalid syntax.

0
10 comments

I tried this multiple ways and I can't reproduce the error that you’re getting. I've dropped it into html, php, js and css files and I do not get the error you’re getting in any of those places. Are you using html in a different file than the ones I've tried? Are you using a templating language? Have you installed any plugins or modified any of the behaviour settings?


O.


0

I can replicate it every time. New project, make a new HTML/XHTML file, and the minute I put a div with an id, it complains. Now, interestingly, if I click the lightbulb and say uninject language, it fixes it. So it seems to be something weird with my language injection, a feature which I have zero understanding of, by the way. I don't know what it does, and the documentation is vague to me.

0

What is your DOCTYPE?

0

I've never seen DOCTYPE used like that...is that legit?

Maybe, try a different one:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

What is the extension of your file(s)?

0

<!DOCTYPE html> is HTML5. And the file extension I'm using is .html in this case. Changing the DOCTYPE did not help. I should mention there's actually just one DIV ID that is causing this, called "comparisons". Though if I rename it, the error is still there.

0

<!DOCTYPE html> yup that's the html5 doctype. Only one I use anymore.

Jack: As for your wayward div is there any way you can pare that file down to it's bare essentials while still having the issue? I'd like to see a copy of the code that's causing that to happen...I'm sure the devs would be interested in testing it as well if it does break on other systems besides your own. I've tried a bunch of different tests today, and as of yet can not replicate this type of issue....I'm starting to wonder if you might have a wayward element in your pages code that is causing this one div to break.

O.

0

Sure, I can replicate it every time.

New project. Make a new file (test.html) and paste this in:


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<div id="makeitmine"></div>
</body>
</html>


And that's it. "makeitmine" is highlighted in red.

0

created test.html. Pasted your code and the only issue I get is that makeitmine is green underlined (spelling error warning.)


My suggestion would be to reset your settings or try disabling any added plugins you have to see if they are causing the issue!

O.

0

Try File | Invalidate Caches

0

Please sign in to leave a comment.