Skip to content
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

Keep the template source code portion corresponding to each AST token #926

Open
GuillaumeGomez opened this issue Dec 6, 2023 · 9 comments · May be fixed by #1058
Open

Keep the template source code portion corresponding to each AST token #926

GuillaumeGomez opened this issue Dec 6, 2023 · 9 comments · May be fixed by #1058

Comments

@GuillaumeGomez
Copy link
Collaborator

GuillaumeGomez commented Dec 6, 2023

In a lot of cases, we emit errors when generating the Rust code in the proc-macro, however we only emit an error without showing where it comes from in the template.

To improve this situation, we could keep a Option<&str> or at least a Option<Range> (which would point to the template source, however this second solution brings its own issues, like when the error comes from imports/extends).

What do you think?

@djc
Copy link
Owner

djc commented Dec 6, 2023

Do you have an example error message that sucked for you? In general I think this makes sense, just hoping it doesn't add too much complexity in the parser.

@GuillaumeGomez
Copy link
Collaborator Author

The last case I had was:

macro "show_header" not found is scope "macros"

So I had to go around to check where this macro was called exactly. Would have been nice to have:

templates.html:92:13: macro "show_header" not found is scope "macros"

As for the overhead, not sure how big it might be. However it'll greatly improve error messages for sure. :)

@djc
Copy link
Owner

djc commented Dec 7, 2023

Makes sense, looking forward to review!

@vallentin @Kijewski how do you feel about asking @GuillaumeGomez to join us as a co-maintainer? @GuillaumeGomez would you be interested?

@vallentin
Copy link
Collaborator

Fine with me. My contributions have been sporadic lately, due to being busy. So another set of talented hands, is definitely welcome!

@GuillaumeGomez
Copy link
Collaborator Author

If I can help with reviews, then sure. Thanks for the offer! :)

@djc
Copy link
Owner

djc commented Dec 18, 2023

@Kijewski friendly ping?

@Kijewski
Copy link
Collaborator

Sorry, I'm kinda overwhelmed by work right now and did not see the message.

Of course, fine with me. Welcome, @GuillaumeGomez! :)

@GuillaumeGomez
Copy link
Collaborator Author

❤️

@djc
Copy link
Owner

djc commented Dec 18, 2023

Sorry, I'm kinda overwhelmed by work right now and did not see the message.

No problem, hope you can enjoy a nice holiday toward the end of the year!

@GuillaumeGomez GuillaumeGomez linked a pull request May 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants