Skip to content

[FEATURE]: Restrict formatting only to the edited range for clang-format (and Prettier) #4603

Closed

Description

@micuintus

Range-Based Code Formatting Enhancement

Overview

Implemented intelligent range-based formatting that only formats edited code sections, preventing unrelated formatting changes from cluttering diffs when using the Edit tool.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Nov 21, 2025
  2. rekram1-node commented on Nov 21, 2025

    @rekram1-node
    Collaborator

    @micuintus you can do this already:

    {
      "$schema": "https://opencode.ai/config.json",
      "formatter": false,
    }
    
  3. self-assigned this
    on Nov 21, 2025
  4. micuintus commented on Nov 21, 2025

    @micuintus
    Author

    @rekram1-node But that means formatting is disabled globally? I cannot tell my LLM in the same session to skip formatting as I could with 6e2d694?

  5. rekram1-node commented on Nov 21, 2025

    @rekram1-node
    Collaborator

    I guess I see what u mean, kinda hesitant to be adding things to edit tool tho

  6. changed the title [-][FEATURE]: Allow skipping the formatting step in the editing tools[/-] [+][FEATURE]: Restrict formatting only to the edited range for clang-format [/+] on Nov 22, 2025
  7. micuintus commented on Nov 22, 2025

    @micuintus
    Author

    @rekram1-node

    I guess I see what u mean, kinda hesitant to be adding things to edit tool tho

    Gotcha!

    I went back to the drawing board and realised: What I actually want is not to discard the formatting, but restrict the auto-formatting to only the sections of the file that were changed.

    1. I updated this issue's description and the PR feat(formatter): restrict formatting to only the changed range of a file.  #4604
    2. Seems be working like a charm (no pun intended :P)
    3. For me it resolves a VERY annoying issue, which rendered OpenCode unusable in these use cases (1000 of formatting changes)
  8. changed the title [-][FEATURE]: Restrict formatting only to the edited range for clang-format [/-] [+][FEATURE]: Restrict formatting only to the edited range for clang-format (and Prettier)[/+] on Nov 22, 2025
  9. 88 remaining items

  10. github-actions commented on Apr 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions