microsoft / vscode-html-languageservice

Language services for HTML
MIT License
226 stars 109 forks source link

Parsing of incomplete html doesn't catch a closing tag without an opening. #149

Open hahn-kev opened 1 year ago

hahn-kev commented 1 year ago

I'm currently using the language service for doing some validation of xml, specifically for invalid xml like the following:

these all work just fine right now, I can use LanguageService.parseHTMLDocument and it'll return a document where those nodes have been parsed and I can then check them to see if they're missing something.

However one case doesn't get returned as a node from the parse function and that's this

is this something that could be fixed? is there another way I should go about validating this html with the language service? I'm using the parsed document for doing a lot of other analysis of the xml so I don't want to just use the scanner as that would be a fair bit of duplicate work, but I'm not sure how else I would go about catching this corner case.