Feature parity with treefmt.rs #22
No reviewers
Labels
No Label
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: numtide/treefmt#22
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/explicit-paths-and-stdin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Introduces remaining features which should bring us into parity with treefmt.rs.
--version
--no-cache
@ -196,0 +195,4 @@
if Cli.Stdin {
walker, err = walk.NewPathReader(os.Stdin)
} else if len(Cli.Paths) > 0 {
walker, err = walk.NewPathList(Cli.Paths)
In terms of behaviour, would you expect
treefmt ./some/gitignored-file
to format or ignore the file?In the previous implementation, the list of paths would be a selector over the normal walker, excludes and includes list.
Thinking on this, if I explicitly provide a path my expectation would be that
treefmt
operates on what I told it to, applying the matching rules based on the config. I wouldn't expect it to be applying gitignore logic too. That seems non-intuitive.You either walk the file system, traverse the git index or operate on exactly what I tell you to operate on.
Is there a good example of why the current behaviour is necessary?
Imagine you want to integrate treefmt with your editor. For example, format the file on save. How does the editor know which files should be formatted? I assume it would just call
treefmt <buffer_file_name>
and expect treefmt to make the decision.🤔 so walk as usual, but filter any paths which don't match the provided paths? In the case of a regular file it's simple, if a directory is provided then it's a prefix check.
How about passing the list of files to the walker?
f7ad34ca68
to557b206227
557b206227
to20b23a5225
20b23a5225
to1f55163b93
feat/explicit-paths-and-stdinto WIP: feat/explicit-paths-and-stdin09e81bdd85
to5e4d61d6d6
@zimbatm followed your approach with passing the path to the walker. I updated
nix fmt
to use the package from the flake and it seems to work. Need to add some tests.5e4d61d6d6
to72bd5960a7
WIP: feat/explicit-paths-and-stdinto feat/explicit-paths-and-stdinfeat/explicit-paths-and-stdinto Feature parity with treefmt.rsa99b9513be
tocb8565d683
yep this is great. I need to do some manual testing to get a better sense of the behaviour, but I think this can be merge already.