Unknown html tag div in PHPStorm 2023.2.3

I'm trying to edit an HTML file in PHPStorm 2023.2.3, and it is throwing warnings for nearly every HTML tag in my document (link, div, ul, li, html, etc.)

If I hover over the tag, it shows me the “Unknown html tag <tag name>” and offers to add a custom tag, but then directly below that, it also displays the tag info from MDM.

I saw in a different thread that some plugins might be causing the error, but I attempted to disable every plugin installed (95% of which are the ones that come bundled) and got the same result.

The only way I can find to get the warnings to stop is to turn off “Unknown Tag” in Editor > Inspections. Any ideas?

0
17 comments

Hi there,

Yeah, also I remember seeing that some custom plugin was causing it. Custom means not bundled by default – you can easily filter them out on the “Settings | Plugins” screen.

Have you tried "File | Invalidate Caches…" and restarting your IDE?

Other than that I would suggest to try "File | Repair IDE…" and follow the steps there (it will suggest those two things above as well).

0

I only have 2 plugins installed that aren't bundled, and neither of them are the culprits. I ran through the File > Repair IDE steps and still having the same issue.  Fun fact: I'm also seeing this same issue in WebStorm 2023.2.4 as well, so this might run a little deeper.

I did recently wipe my MacBook Pro and restored from a Time Machine backup. I might try reinstalling the apps themselves and see if that does anything.

0

Just for the future, you may disable all custom plugins at once with one action:

As for the reinstallation, you might want to recreate IDE configuration files by renaming the config directory:
https://www.jetbrains.com/help/phpstorm/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory

0

Thank you for that Vasiliy, that menu option is how I found out I only had 2 downloaded plugins.

I turned off settings sync, shut down PHPStorm, and renamed the log, cache, and configuration directories (example: ~/Library/Application Support/JetBrains → ~/Library/Application Support/JetBrains-backup). I also went into my primary project and renamed the .idea directory, just in case. Finally, I uninstalled and reinstalled PHPStorm through the Toolbox app.

When I restarted PHPStorm, I told it not to import any configuration. Once I reopened my project and it reindexed everything, the errors are still there.

Now I'm really curious, so I'm spinning up a Sonoma VM and doing a completely clean install. We'll see what that turns up.

0

Clean install/free trial on a Sonoma 14.1 VM, same errors.

Clean install on a Ventura 13.6 VM, no errors.

Both were installing the Apple Silicon version.

0

Thank you for trying my suggestion.
Would it be possible to share one of the affected files?

0

Would it be possible to share one of the affected files?

Ah, disregard this for now. Sorry, I missed the part with another machine where it is not reproducible.
Does it happen for all files or some old files are affected only? 

Would it be possible to install PhpStorm 2023.3 EAP build and check if it also happens there?
https://www.jetbrains.com/phpstorm/nextversion/

 

0

I tried the EAP on my main machine yesterday (which was before blowing out all of the config), and got the same errors. Tried it just now on both the Ventura and Sonoma VMs (deleted the application, as well as the log, cache, and config directories), and I got the same result as 2023.2.3: no errors on Ventura, errors on Sonoma.

0

For reference, this is the main file I've been testing against: https://hpmwebv2.s3-us-west-2.amazonaws.com/projects/hpm-new.html

The project I'm using on the VMs is that file with a folder of assets that that file references.

0

Jcounts 

That link, I follow it, see the source, save it and then open in my PhpStorm 2023.2.3 – it shows no such errors here.

Can you try the following: 

  1. Disable a few bundled plugins for JavaScript frameworks – like Vue.js, Angular, Next.js. Restart the IDE. Any difference?
  2. Please Show a screenshot of how such a file/tag is looks. Ideally using bundled standard light theme (I'm more familiar with those colors). Maybe it will show something off.
  3. Any entries at “Settings/Preferences | Editor | Language Injections” that have “Project” or “IDE” in the last Scope column?
  4. What do you have at “Settings/Preferences | Languages & Frameworks | Schemas and DTDs | Default XML Schemas” – maybe something there…
1

Also, could you please try to cmd+click on a simple tag like <div>, where would it navigate to?

0

Andriy and Vasiliy, thank you so much for taking the time to help me on this. I think I found the solution and it is fairly dumb.

I have 2 versions of the HTML file I linked above. One has this HTML tag:

<html lang="en-US" dir="ltr">

And the other one has this:

<html lang="en-US" xmlns="https://www.w3.org/1999/xhtml" dir="ltr" prefix="og: https://ogp.me/ns# fb: https://ogp.me/ns/fb#">

If you remove the xmlns="https://www.w3.org/1999/xhtml" declaration from the second one, all of the errors go away.

Here's a screenshot of the code with the mouseover with the xmlns declaration and one without.

Before I figured this part out, I had checked #3 and #4 that Andriy mentioned. I didn't have any entries with “Project” or “IDE” in the Scope column, and under Default XML Schemas, I had HTML 5 and XML Schema 1.1 selected.

Vasiliy, if the errors were showing, cmd+clicking a <div> didn't do anything, but without the error, it linked to the block.rnc path that you mentioned above.

I'm also realizing that my virtual machine tests were goofed up because I wasn't using the exact same file in both. The file in the Ventura VM did not have the xmlns declaration, while the Sonoma one did. Putting the declaration back into the Ventura file surfaced the errors, and removing it from the Sonoma VM made them go away.

I was wondering why I didn't see this sooner, but I realized that when I removed the xmlns declaration on my main machine, I had already turned the ‘unknown html tag’ inspection off.

16 years as a web developer, and code still finds new ways to keep you humble.

Thanks again for all of your help!

2

Great.

If you remove the xmlns="https://www.w3.org/1999/xhtml" declaration from the second one, all of the errors go away.

The issue is not in this snippet. I mean – it is, but not in the snippet itself (because it is present) .. but in the fact that it has wrong value. Yeah.

You see… this https://www.w3.org/1999/xhtml is NOT an URL, it's actually an ID. And the correct value uses http and NOT https. Try it – add that snipped back but with http and see what the IDE will say.

(the resource file might not be 100% correct one, but it shows what namespace (ID) it has)

1

Thank you for this update and posting the solution! 
I believe it may help other members of community.

0

Well, would you look at that. Remove the ‘s’ from 'https' and it works. Thank you for pointing that out, Andriy, I learned something new today.

0

Uninstalling the AI assistant plugin, came with one of the Webstorm updates, solved this problem for me. Disabling it didn't do it, I had to uninstall it.

0

Looking at the answers/solution: is this really default desired behaviour of PhpStorm? as there are frameworks and occasions that a single php file may not have the <html> elements in them, such as codeignitor and as such it gives these errors about div being a custom tag. I'd say it is not ideal default behaviour of the IDE.

1

Please sign in to leave a comment.