templ autoformat does not apply #8965
-
SummaryWhen working with the templ LSP autoformating does not work. Running
Here's a quick recording of my experience, in the clip: https://www.youtube.com/watch?v=tKoeQ7kArsc
Thanks, I realize this could (likely) a user error. Reproduction StepsI tried this:
I expected this to happen: Instead, this happened: Helix logThere are no related logs. PlatformmacOS Terminal Emulatoriterm2 Build 3.4.22 Installation Methodbrew Helix Versionhelix 23.10 (f6021dd) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
I may have prematurely made this bug report. It seems that adding a formatter to the languages.toml could do the trick? I would appreciate a more experienced contributors take on this :) If this looks correct, I can submit a PR! Eg: https://github.com/helix-editor/helix/blob/master/languages.toml#L2922 [[language]]
name = "templ"
scope = "source.templ"
file-types = ["templ"]
roots = ["go.work", "go.mod"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
language-servers = [ "templ" ]
# adding this line?
formatter = { command = "templ" , args = ["fmt", "--stdin"] } |
Beta Was this translation helpful? Give feedback.
That sets up an external formatter, so the file will be piped through that command. Instead I think you should just be able to enable the auto-format for templ: