Skip to content

fix(odinfmt): discover odinfmt.json per file in directory mode - #1676

Open
i-api wants to merge 1 commit into
DanielGavin:masterfrom
i-api:fix/odinfmt-dir-mode-per-file-config
Open

i-api wants to merge 1 commit into
DanielGavin:masterfrom
i-api:fix/odinfmt-dir-mode-per-file-config

Conversation

@i-api

@i-api i-api commented Sep 11, 2026

Copy link
Copy Markdown

Directory mode resolved one config from the invocation root and applied it to the entire file walk, while single-file mode and the language server resolve per file.

Any file under a nested odinfmt.json scope was formatted with the wrong style by odinfmt <dir> -w, which the next per-file/editor run then flipped back - a self-renewing churn loop. It also silently applies ancestor-scope (or default) style to nested scopes on every bulk run.

This change resolves the config per walked file, exactly like single-file mode. An explicit --config still wins for the whole walk.

Repro (before): parent scope align_struct_values=false + nested scope true; odinfmt <parent> -w left the nested file unaligned while single-file mode aligns it. A 109-char line under a width-120 nested scope inside a width-100 parent was reflowed by dir mode but kept by single-file mode. After: dir mode matches single-file mode on both.

Snapshot suite (tools/odinfmt/tests.odin) passes.

Directory mode resolved one config from the invocation root and applied it to the entire walk, while single-file mode and the language server resolve per file. Any file under a nested odinfmt.json scope was formatted with the wrong style, which the next per-file run then flipped back. Resolve per file (explicit --config still wins for the whole walk).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant