-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Line numbers for errors in the html parser #6338
Comments
Is this what we should be looking at in relation to this issue? https://github.com/vuejs/vue/blob/dev/src/compiler/parser/html-parser.js#L299 Well, there's also this one: https://github.com/vuejs/vue/blob/dev/src/compiler/parser/html-parser.js#L188 It's location is self-explanatory. |
Yes, these are definitely the warnings I am referring to. |
+1 for this. Right jumped into vue and that would realy help to debug the html code This request is related to this pr: #7127 |
What problem does this feature solve?
Errors raised by the html parser (
options.warn
in the code) don't register the location of the error.With the location it will be much easier to debug.
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.
What does the proposed API look like?
In
parseHTML
we could add a property in options that will include the line at which the HTML is included in the.vue
file. We can use this to offset the location before printing it.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.
The text was updated successfully, but these errors were encountered: