[PR #3042] fix: clang formatter name #10517

Closed
opened 2026-02-16 18:15:11 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3042

State: closed
Merged: Yes


My Report

My project have a .clang-format file in the home directory, opencode will ALWAYS run clang-format if that file exists. using custom configurations like disableing formatters is totally ignored, so i had to apply this fix to tell it not to ignore me.

Grok Explanation of the bug and the fix

The bug was that the formatters object was keyed by the export names from the Formatter module (e.g., 'clang'), but the configuration uses the name property of each formatter (e.g., "clang-format"). This mismatch meant that disabling a formatter in the config, like setting "clang-format": { "disabled": true }, wouldn't actually remove it because delete formatters["clang-format"] was trying to delete a key that didn't exist.

I fixed this by rebuilding the formatters object to use the name property as keys instead of the export names. Now the keys match what the config expects, so disabling formatters works correctly.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3042 **State:** closed **Merged:** Yes --- ## My Report My project have a .clang-format file in the home directory, opencode will ALWAYS run clang-format if that file exists. using custom configurations like disableing formatters is totally ignored, so i had to apply this fix to tell it not to ignore me. ## Grok Explanation of the bug and the fix The bug was that the formatters object was keyed by the export names from the Formatter module (e.g., 'clang'), but the configuration uses the name property of each formatter (e.g., "clang-format"). This mismatch meant that disabling a formatter in the config, like setting "clang-format": { "disabled": true }, wouldn't actually remove it because delete formatters["clang-format"] was trying to delete a key that didn't exist. I fixed this by rebuilding the formatters object to use the name property as keys instead of the export names. Now the keys match what the config expects, so disabling formatters works correctly.
yindo added the pull-request label 2026-02-16 18:15:11 -05:00
yindo closed this issue 2026-02-16 18:15:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10517