-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
bug: ambiguous child/string expression grammar #892
Comments
@joerdav - looks like we have ambiguous grammar here. @Test() { // Children of "@Test()" } @Test() { "string to output" } Ideas? |
@a-h one potentially breaking option would be to disallow block elements on a single line? Make a new line after |
Sounds like a sensible plan of action to me. |
I wonder if there is something we can do to communicate this to affected users? It could be surprising for the contents of the curly braces to be printed as children rather than interpolated. I've also noted in this example that we don't stop a user from calling a component with children, even if the children are never rendered. One to think about! |
Describe the bug
Templ generates wrong code for an expression which has a component in front of it.
To Reproduce
Expected behavior
The code snippet from above generates
<div>test</div>
and doesn't print value from{ value }
expression. It does work though if you either put any character between component call & expression or put expression on a new line.Also when I run formatter it formats code like so:
(like a function definition? xd)
templ info
outputDesktop:
gopls
version: idkThe text was updated successfully, but these errors were encountered: