<h3 dir="auto">What problem does this feature solve?</h3>
<p dir="auto">Recently I am trying to write a webpack loader for vue component, during which I came across the package <code class="notranslate">vue-template-compiler</code>.<br>
It works perfectly except that it doesn't have any location info in the ast.</p>
<p dir="auto">I read something here:</p>
<p dir="auto"><a href="http://echizen.github.io/tech/2017/10-29-vue2wx" rel="nofollow">http://echizen.github.io/tech/2017/10-29-vue2wx</a></p>
<p dir="auto">It's in Chinese, but you can see the ast result from the compiler method has "originLine" to indicate position.<br>
But When I tried it I didn't get the "originLine", link:</p>
<p dir="auto"><a href="https://runkit.com/fleksin/5b754fd8f424830012365766" rel="nofollow">https://runkit.com/fleksin/5b754fd8f424830012365766</a></p>
<p dir="auto">So I am not sure if it's already a feature or is it removed from 2.5.17, or am I missing something in the options ?<br>
btw,  the version of vue-template-compiler I'm using is 2.5.17.<br>
Some general direction would be much apprieciated.<br>
Thanks in advance :)</p>
<h3 dir="auto">What does the proposed API look like?</h3>
<p dir="auto">return ast like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
   ast:   {
      ...
     originLine: xx,
   }
}
"><pre class="notranslate"><code class="notranslate">{
   ast:   {
      ...
     originLine: xx,
   }
}

</code></pre></div>
<h3 dir="auto">What problem does this feature solve?</h3>
<p dir="auto">Errors raised by the html parser (<code class="notranslate">options.warn</code> in the code) don't register the location of the error.</p>
<p dir="auto">With the location it will be much easier to debug.</p>
<p dir="auto">For example if I forget to close an HTML tag, the compiler will complain and tell me the name of the tag. However I will have no idea where the opening tag is located. For moderately big files it's quite impractical.</p>
<h3 dir="auto">What does the proposed API look like?</h3>
<p dir="auto">In <code class="notranslate">parseHTML</code> we could add a property in options that will include the line at which the HTML is included in the <code class="notranslate">.vue</code> file. We can use this to offset the location before printing it.</p>
<p dir="auto">As for getting the locations themselves I have no idea how to proceed. If someone can give me some pointers I may submit a pull request.</p>