How to enable VS Code HTML error checking / validation?

Marc picture Marc · Jun 15, 2017 · Viewed 42.2k times · Source

I have just switched to Visual Studio Code for web development from Netbeans and am finding my way around. In Netbeans, if I forget the closing bracket on a tagname it will indicate my error with a red squiggly underline, and the alert in the left margin.

I would have thought error checking to be a fundamental function in a web dev editor like vs code. Maybe I am just not finding the right option or extension.

How can I achieve this same html, css error checking behaviour in VS Code?

Answer

Nimeshka Srimal picture Nimeshka Srimal · Jun 15, 2017

VSCode doesn't have HTML validation by default. But it allows you to add extensions and enable these features.

To add HTML validation (linting), Open VSCode, then press Ctrl + P and then paste ext install HTMLHint in it, and press enter. It will install a HTML validator. You may need to reload VSCode to load the extension.

Now if you open the same html document you had the syntax error, you should see there's an issue shown at the status bar at the bottom :) and it will also show you the errors in those lines.