glimmer-vm
glimmer-vm copied to clipboard
Include file name and source locations in template compiler errors
When throwing errors such as this we should at the very least include the hbs file name and source location of the error. Debugging this sort of error is pretty hellish when you've changed a lot of template code. It seems like the compiler is already set up to include source location in the meta of an opcode statement, it's just hard-coded to be switched off. Would be happy to starting working on this if people have any guidance on implementation!
@sclaxton IMO this is one of the highest-priority things we can work on. We've built a programming language and runtime, we should report errors as such. I know there was a branch that was working on this that went stale. I will try to track down who was working on that and see if it might be useful for you to get an idea of the implementation strategy.
We already have source information propagated through the AST, so it should "just" be a matter of propagating that information down to generated opcodes in development mode.
Thanks @tomdale! That stale branch would be super helpful just to get an idea since I'm new to the code.
Related: I also saw that @wycats opened #418 a while ago. Moving to a "reporter" structure could be a follow-up to this change. I would love to start a quest-style effort to make glimmer's error reporting super robust.
@sclaxton and @tomdale if you're interested in working on this, I'd be happy to put together a quest for this problem and help work through the needed steps.
@wycats I am interested! I would also really appreciate the help getting started on the quest :)
@wycats @sclaxton did you two ever sync up? this still seems like a very valuable thing to do :)
I'm definitely still interested :) A co-worker was just telling me yesterday how he wished template errors had better reporting, so this is very much still a relevant problem for me. Totally forgot I had opened this issue...