-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Formatting not working as expected #576
Comments
@RafaelZasas What version of templ are you running? |
I am running v0.2.543 |
@RafaelZasas Did you install it via |
Though we'll be cutting a stable release soon :) |
I have made a discussion post about this without much traction.
My editor setup has been left at the bottom.
TLDR
Templ is formatting my html in a way that is frustrating, and I cant seem to get around it. I assume that I have made a mistake somewhere, but if this is actually the formatting of templ fmt, I believe it is far too opinionated.
Take this snippet for example:
I have absolutely no Idea why it keeps forcing attributes onto the same line, even after I manually break it up.
What I have tried
I manually edit the following piece to have attributes on a single line:
But once I save, I get this back:
The formatting is the same when I use templ fmt on the file.
The formatting doesn't make any logical sense to me. Why break in the middle of the src attr? At which line length does it decide to break? The formatting rules seem extremely opaque and hard to understand.
Editor setup
I am using neovim with a Lsp-Zero setup. The LSP is installed with Mason and mason-lspconfig.
As per These Instructions I have specifically opted for lsp-zero to format templ files with only the templ LSP.
This is my
mason.lua
file with my mason handlers:The text was updated successfully, but these errors were encountered: