Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File-lines seems to require stdin #5762

Closed
barafael opened this issue May 4, 2023 · 2 comments
Closed

File-lines seems to require stdin #5762

barafael opened this issue May 4, 2023 · 2 comments

Comments

@barafael
Copy link

barafael commented May 4, 2023

I ran rustfmt like this:

rustfmt --unstable-features ==file-lines '[{"file":"presentation.md","range":[31,33]}]'

This puts rustfmt in a prompt where it awaits terminal input. When I hit CTRL+D to terminate, I get:

Warning: Extra file listed in file_lines option '/path/to/example-project/presentation.md'

This also happens when the file in question ends with .rs.

This behaviour is similar to passing "stdin" as file.

I am wondering if I am using this incorrectly or what is going on here?

$> rustfmt --version
rustfmt 1.5.2-nightly (473f916 2023-05-03)
@ytmimi
Copy link
Contributor

ytmimi commented May 4, 2023

@barafael unfortunately, rustfmt doesn't format rust code blocks in markdown files, so what you're trying to do won't work. There's an open issue for formatting rust code blocks in markdown files, but i's pretty low priority right now #2036.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2023
@ytmimi
Copy link
Contributor

ytmimi commented May 4, 2023

That being said, when you don't pass a file to rustfmt like rustfmt /path/to/file.rs rustfmt expects that the input you want to format will come from stdin. You can see this comment and the following discussion for more details.

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

No branches or pull requests

2 participants