Replies: 7 comments 11 replies
-
Lines 472 to 482 in 482cc22 You can set this in your config to enable formatting through the language server on save: # ~/.config/helix/languages.toml
[[language]]
name = "python"
auto-format = true |
Beta Was this translation helpful? Give feedback.
-
having the same issue, even after configuring it with prettier, doing [[language]]
name = "html"
formatter = { command = 'prettier', args = ["--parser", "html"] }
auto-format = true
[[language]]
name = "json"
formatter = { command = 'prettier', args = ["--parser", "json"] }
[[language]]
name = "css"
formatter = { command = 'prettier', args = ["--parser", "css"] }
[[language]]
name = "javascript"
formatter = { command = 'prettier', args = ["--parser", "typescript"] }
auto-format = true
[[language]]
name = "typescript"
formatter = { command = 'prettier', args = ["--parser", "typescript", "--printWidith", "100"] }
auto-format = true |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a list of LSP that have auto-format as disabled by default at all? |
Beta Was this translation helpful? Give feedback.
-
This seems very confusing to me. The docs say that The default languages.toml does not override this default: (in this case for python): Line 807 in e76020d The editor tells me that auto-format is enabled:
And yet |
Beta Was this translation helpful? Give feedback.
-
IMO no language should have auto-format by default. If someone adds auto-format = true to their config, it should work for all languages straight away, and then you can override it in language.toml. |
Beta Was this translation helpful? Give feedback.
-
Why was this issue closed? I can't see how this is not a bug. On helix 24.7 I enabled format on write in config.toml: [editor]
auto-format = true ... but my python code will only format with the I enable format-on-write to python specifically in languages.toml by adding the line: [[language]]
name = "python"
auto-format = true I do |
Beta Was this translation helpful? Give feedback.
-
I wanted to use black as a formatter for python, but initially the auto-format didn't run. |
Beta Was this translation helpful? Give feedback.
-
Summary
The command
:format
works fine but even ifeditor.auto-format
is set totrue
the file is not formatted on:write
.Am I missing something?
Reproduction Steps
Set
editor.auto-format = true
(it should be the default).Run this to install the python lsp and all its extensions:
pip install "python-lsp-server[all]"
Copy/paste this code in a pyton file and open it
A warning should appear:
E303 too many blank lines
.Running
:write
does not format the file, but running:format
will.Helix log
Nothing was written in the log file
Platform
Linux
Terminal Emulator
wezterm 20221119-145034-49b9839f
Helix Version
helix 22.12
Beta Was this translation helpful? Give feedback.
All reactions