Skip to content

opencode ran my code through an auto-formatter? #1482

Closed

Description

@kentonv

I was trying opencode. I asked Claude to make a small change to a C++ file. Before making the change, for some reason the entire file was auto-formatted. Notably, the project in question does not use auto-formatting, and the formatting rules applied do not resemble those from any project I've worked on. It seems like something just decided to pass the file to an arbitrary C++ auto-formatter with default settings? This ruined the change of course, as almost every line was modified to a style I don't use.

opencode should not be auto-formatting files when there is no auto-formatting config present.

Activity

  1. thdxr commented on Jul 31, 2025

    @thdxr
    Member

    our clang-format detection was bad - now only enabling if .clang-format is there

  2. ElWazy commented on Nov 24, 2025

    @ElWazy

    Same issue with Python projects. Files are being auto-formatted despite explicitly disabling formatters in opencode.json.

    I've tried disabling uv and ruff both globally and per-project, but the formatting still occurs:

    {
      "$schema": "https://opencode.ai/config.json",
      "formatter": {
        "uv": {
          "disabled": true
        },
        "ruff": {
          "disabled": true
        },
        "prettier": {
          "disabled": true
        }
      }
    }

    The configuration appears to be ignored completely.

  3. rekram1-node commented on Nov 24, 2025

    @rekram1-node
    Collaborator

    @ElWazy where is your opencode.json located?

    also if you hate formatting you can always do:

    "formatter": false

    instead of doing each individual one

  4. ElWazy commented on Nov 25, 2025

    @ElWazy

    Thanks @rekram1-node ! Setting "formatter": false worked perfectly.

    For context, I had opencode.json in both locations:

    • Project root (same level as pyproject.toml)
    • Global config: ~/.config/opencode/opencode.json

    Disabling the formatter completely solved the issue. Appreciate the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions