opencode icon indicating copy to clipboard operation
opencode copied to clipboard

formatters: `cargo fmt` is formatting whole workspace instead of edited file

Open goniz opened this issue 1 day ago • 7 comments

Description

Newly added cargo fmt Rust formatter is invoked with cargo fmt -- $FILE but in practice is formatting the whole Cargo workspace.

cargo fmt actually does not support formatting single files

This change was introduced in version 1.1.2 by this commit: https://github.com/anomalyco/opencode/commit/cdd6ea514b94d8ce71770bb02f33ab979e9ee0f6

Plugins

none

OpenCode version

1.1.16

Steps to reproduce

  1. Create a Cargo project with 2 Rust files
  2. Introduce a change that would be formatted in file A.rs
  3. Ask to edit file B.rs in opencode
  4. both files A.rs and B.rs would be formatted

Screenshot and/or share link

https://opncd.ai/share/elWQVtdO

Operating System

Omarchy

Terminal

Ghostty

goniz avatar Jan 13 '26 09:01 goniz