Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: try to get line number of errors #3409

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

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.

2 participants