marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.35k stars 643 forks source link

DevX: Compiler point to a HTML tag when there is a token error in the JS in the template #1331

Closed ccinelli closed 5 years ago

ccinelli commented 5 years ago

Marko Version: 4.16.0

Details

Error:

Missing ending "div" tag at line 6 col 0

Code:

class {
  onCreate() {
  }
}

<div>

  $ const a =23s2; // What? 
</div>

Expected Behavior

The error should point to the line with the incorrect token (23s2).

Actual Behavior

Missing ending "div" tag at line 6 col 0. This pretty much the same code in #1330 I just added a comment...

Steps to Reproduce

Copy the code in https://markojs.com/try-online

DylanPiercey commented 5 years ago

This particular issue was due to an error in parsing comments which was resolve here: marko-js/htmljs-parser#71