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

Add --stdin-filepath option to format cmd #250

Merged
merged 1 commit into from
May 1, 2022

Conversation

lffg
Copy link
Contributor

@lffg lffg commented Apr 30, 2022

This PR introduces the --stdin-filepath option to the format command.

This was inspired by ESLint's --stdin-filename and Prettier's --stdin-filepath. It doesn't have any behavior in the actual parsing of files or their resolution.

It is mainly useful when showing error information. In such cases, instead of getting:

  ┌─ -:2:5
  │
2 │ [bar=6
  │     ^ expected "]"

One would get:

  ┌─ ./foo.toml:2:5
  │
2 │ [bar=6
  │     ^ expected "]"

By executing format as taplo format --stdin-filepath ./foo.toml -.

crates/taplo-cli/src/commands/format.rs Outdated Show resolved Hide resolved
@tamasfe
Copy link
Owner

tamasfe commented May 1, 2022

Thanks, I left a comment about a tiny detail, otherwise LGTM.

@tamasfe tamasfe merged commit 826d705 into tamasfe:master May 1, 2022
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.

2 participants