You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Writing a template that contains a simple if, else if, else.
The bug I am experiencing is that the else if is not respected. the else in the else if ends up becoming an attribute in the HTML component and the if statement starts again on the second if with the final else being respected.
Note: I have noticed that the LSP will reformat it, however, I have saved with :noa w to prevent formatting and I still get this issue. So I don't believe this is an LSP issue.
After some more digging I realised this is not a bug, but an unimplemented feature. Currently attributes do not support "else if" only simple if and else clauses.
Out of curiosity, because it still seems to work as expected, is this just a case of the second following if and else statements potentially still getting evaluated in some cases, but not assigning class a second time?
Describe the bug
Writing a template that contains a simple if, else if, else.
The bug I am experiencing is that the else if is not respected. the else in the else if ends up becoming an attribute in the HTML component and the if statement starts again on the second if with the final else being respected.
Note: I have noticed that the LSP will reformat it, however, I have saved with
:noa w
to prevent formatting and I still get this issue. So I don't believe this is an LSP issue.To Reproduce
Expected behavior
I would expect that the if, else if, and else are all evaluated as necessary.
Screenshots
In use:
The relevant part of the component:
After the LSP has its way with it:
Rendered in the browser:
Logs
If the issue is related to IDE support, run through the LSP troubleshooting section at https://templ.guide/commands-and-tools/ide-support/#troubleshooting-1 and include logs from templ
templ info
outputRun
templ info
and include the output.Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: