Open MilkeeyCat opened 3 weeks ago
@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 {
and before }
a requirement. Otherwise it will be detected as interpolation?
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: idk