The stdout from ruff format
overwrites the file contents when auto-format = true
#13654
-
SummaryWhen using
Instead of its formatted contents. (I'm unsure of if this is a bug with regards to Helix or Ruff, but overwriting the file contents with the formatter's stdout seems more likely to be a bug within the editor, since the actual formatting works). Reproduction StepsI opened a file in a Python project environment I am working in, changed nothing, and wrote the file contents with
As its entire contents. Undoing the change once yielded the file result I expected (the formatted file contents), but this is impossible to write from within Helix. Using My config for [[language]]
auto-format = true
file-types = ["py"]
language-servers = ["ruff"]
name = "python"
[language.formatter]
args = ["format"]
command = "/nix/store/v7s30nbh27pvn626q4wmhwmw910rkjxs-ruff-0.11.11/bin/ruff" Helix log
PlatformLinux (NixOS) Terminal Emulatorghostty Installation Methodflake, from master Helix Versionhelix 25.01.1 (2bd7452) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
External formatters are expected to take the current file in through stdin and print the formatted file to stdout. The command here should be |
Beta Was this translation helpful? Give feedback.
External formatters are expected to take the current file in through stdin and print the formatted file to stdout. The command here should be
ruff format -
instead to have ruff use stdin/stdout instead of directly writing to files.