refactor(oxfmt): Make support.rs simple#17109
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the file format detection logic in oxfmt to prepare for future oxfmt-toml support. The refactoring improves code organization by separating the parser name resolution logic and making the file type detection flow clearer.
- Extracts parser name logic from
get_external_format_sourceinto a newget_external_parser_namefunction that returns just the parser name string - Adds a new
can_format_without_external()method to check if a file can be formatted without external dependencies - Reorganizes the file detection flow in
TryFrom<PathBuf>to be more explicit and sequential
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/oxfmt/src/core/support.rs | Refactors file format detection by extracting parser name resolution into a separate function, adds can_format_without_external() method, and reorganizes the detection flow in TryFrom<PathBuf> |
| apps/oxfmt/src/cli/walk.rs | Updates tier comments to reflect future TOML support and uses the new can_format_without_external() method instead of direct pattern matching |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
59447a2 to
c845bab
Compare
support.rs simple
c845bab to
83e8dd6
Compare
Merge activity
|
Also prepare for `toml` support.
83e8dd6 to
750d4b3
Compare

Also prepare for
tomlsupport.