This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
Allow formatting from stdin #2855
silversquirl
started this conversation in
Suggestions
Replies: 1 comment
-
Great suggestion! Yes, I suppose it makes sense to have some argument like this! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Most other code formatters support reading code from stdin and outputting formatted code to stdout. This is a very useful standard interface for code formatters, and allows very easy integration with editors, such as through Kakoune's
formatcmd
option.Since Rome can format multiple types of files, it needs to detect the filetype somehow; currently it uses the file extension for this, which would be incompatible with formatting from stdin. Options for handling this include a flag to specify the filetype from the command line (eg.
rome format --stdin --filetype js
), which would allow rome to benefit from the editor's detection; or copy what Prettier does and use a flag to specify the filename of the data provided on stdin (eg.rome format --stdin --stdin-filename hello.js
).Beta Was this translation helpful? Give feedback.
All reactions