Skip to content

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

@goniz

Description

@goniz

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: cdd6ea5

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions