question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is location of `HTMLClose` comment correct?

See original GitHub issue
comments = []; require('meriyah').parse('<!--\na\n-->', {onComment: comments, webcompat: true, ranges: true});comments
[
  { type: 'HTMLOpen', value: '', start: 0, end: 4, range: [ 0, 4 ] },
  { type: 'HTMLClose', value: '', start: 6, end: 10, range: [ 6, 10 ] }
]

We have [6, 10], while babel has [7, 10]

require('@babel/parser').parse('<!--\na\n-->').comments
[
  {
    type: 'CommentLine',
    value: '',
    start: 0,
    end: 4,
    loc: SourceLocation {
      start: [Position],
      end: [Position],
      filename: undefined,
      identifierName: undefined
    }
  },
  {
    type: 'CommentLine',
    value: '',
    start: 7,
    end: 10,
    loc: SourceLocation {
      start: [Position],
      end: [Position],
      filename: undefined,
      identifierName: undefined
    }
  }
]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
KFlashcommented, Nov 12, 2020

Your solution seems expensive? For this comment for (/* comment 1 */;/* comment 2 */;/* comment 3 */);. Calculate the spaces between ( and ). Then use a code that can grab the comments in that range. You also need to calculate on leading and trailing.

The point is too only attach the comments, right? So after you got that array returned, you attach the comment and use the range and source length and there you go ! 😃

0reactions
KFlashcommented, Nov 12, 2020

I tweeted and mentioned you there. Anyway. Check your email. After that you can go to the /emitter folder where I’m playing around ATM. And also check out last part of the whitespace.ts file in the scanner folder.

I think that should answer your problems

Read more comments on GitHub >

github_iconTop Results From Across the Web

The HTML Comment Tag: Here's How To Use It In Your Code »
Another thing you can do is put comments after closing tags, to help you find where a particular element ends. (This can be...
Read more >
HTML Comments - W3Schools
HTML comments are not displayed in the browser, but they can help document your HTML source code. ... Comments can be used to...
Read more >
How to Comment & Comment Out in HTML - HubSpot Blog
In HTML, a comment is text enclosed within < !╌ ╌> tags. This syntax tells the browser that they are comments and should...
Read more >
is closing HTML comments without a -​- delimiter
<br> first because the Markdown system doesn't care about your HTML comment. They're not allowed, so it doesn't search for the closing -->...
Read more >
What are valid places to put HTML comments? - Stack Overflow
You can place comments between any tag, but not inside of a tag declaration. So, this is correct: <code><!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found