Closed lephyrius closed 8 years ago
Hi @lephyrius, thanks for checking out slim_fast
! We've been hard at work on adding slim parsing and error messaging has not been fleshed out. You're right though, it's annoying when you need to debug!
One of the problems at play is how we do parsing and evaluation. In the current implementation slim
parsed into a long eex
string and then evaluated. I suspect that's why the errors are always on line 1. If your slim
was malformed the parsing would error out and that we could certainly handle better too. In this situation I think the error is actually in the resulting eex
which could be more challenging.
That all said, this is definitely something we should look at tackling. We welcome contributions so if you want to take a stab at it please do!
I have added option to keep original lines when converting to eex template here: https://github.com/Rakoth/slime/commit/eb195b26f20dc05ccdc6b3f8751f1c7b996beb73 .
Output is a bit different with and without this option, for example |
works like'
, empty lines are not ignored, so this is debug-only feature and I am not sure if I should make a PR @doomspork .
To use it add this: config :slime, :keep_lines, true
to config/config.exs
@Rakoth I think this is a good idea, a PR would be worth opening. That'll give @henrik and @lpil an opportunity to provide feedback as well.
@Rakoth Do you plan to submit a PR?
@jamonholmgren Yep, https://github.com/slime-lang/slime/pull/91
Addressed in #91
** (SyntaxError) web/templates/page/index.html.slim:1: syntax error before: '|'
** (SyntaxError) web/templates/layout/app.html.slim:1: unexpected token: "}". "(" starting at line 1 is missing terminator ")"
I've been trying to convert from ruby slim to slim fast. It's annoying to only get "line 1 syntax errors".Have I missed some configuration setting? Is this planned on making it better in the future?