Skip to content

Conversation

@sidvishnoi
Copy link
Member

@sidvishnoi sidvishnoi commented Mar 27, 2021

By adding a special comment at the end of each line as a pre-process step (in Node, not respec), we can estimate the location of error in source, which can be very useful in CI. For every element, we can find the "nearest" (with some heuristics) HTML comment matching that pattern and we'll get access to line number.

  • Does anyone know of a way to add such comments? We mostly need to skip adding comments inside <style>, <script> and <title> elements. The solution probably involves using a parser like parse5 or htmlparser2, does anyone have some experience with them?
  • showError can have error location hints, e.g., "at the end of element", "at the start of element", "at line N in this element" (WebIDL.js already gives us last one).
screencast_00000.mp4

@sidvishnoi sidvishnoi force-pushed the sourcemap branch 2 times, most recently from 70fd420 to 4e137cc Compare March 27, 2021 19:59
@marcoscaceres
Copy link
Contributor

The solution probably involves using a parser like parse5 or htmlparser2, does anyone have some experience with them?

Not me, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Low priority Suggestions with no good driving force

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants