-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using treefmt in stdin mode on a justfile, I get a warning "no formatter for path".
To Reproduce
Here is my example:
echo "set quiet := true
# print this message
help:
just --list --list-submodules --unsorted
# interactive recipes launcher
choose:
just --choose --unsorted
mod init 'just/init.just'
mod bootstrap 'just/bootstrap.just'
mod apply 'just/apply.just'
"|treefmt --stdin justfile
and my result:
WARN no formatter for path: 1621644870
set quiet := true
# print this message
help:
just --list --list-submodules --unsorted
# interactive recipes launcher
choose:
just --choose --unsorted
mod init 'just/init.just'
mod bootstrap 'just/bootstrap.just'
mod apply 'just/apply.just'
traversed 1 files
emitted 0 files for processing
formatted 0 files (0 changed) in 18ms
Expected behavior
The same example just adding a . in front of justfile:
echo "set quiet := true
# print this message
help:
just --list --list-submodules --unsorted
# interactive recipes launcher
choose:
just --choose --unsorted
mod init 'just/init.just'
mod bootstrap 'just/bootstrap.just'
mod apply 'just/apply.just'
"|treefmt --stdin .justfile
works flawlessly:
set quiet := true
# print this message
help:
just --list --list-submodules --unsorted
# interactive recipes launcher
choose:
just --choose --unsorted
mod init 'just/init.just'
mod bootstrap 'just/bootstrap.just'
mod apply 'just/apply.just'
traversed 1 files
emitted 1 files for processing
formatted 1 files (1 changed) in 21ms
Possible explanation
I suspect that the copy of stdin to a file with the same extension as the original file doesn't work well if original file has no extension:
Line 28 in a6ea040
| // read stdin into a temporary file with the same file extension |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working