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

Closed
opened 2026-02-16 17:50:23 -05:00 by yindo · 0 comments
Owner

Originally created by @goniz on GitHub (Jan 13, 2026).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @goniz on GitHub (Jan 13, 2026). Originally assigned to: @rekram1-node on GitHub. ### 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
yindo added the bug label 2026-02-16 17:50:23 -05:00
yindo closed this issue 2026-02-16 17:50:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5242