That can't be done without running an Elixir node. It is your choice if you
want to have a node always running or not, but you need to run Elixir one
way or the other. In the most basic setup, it is as simple as:
echo "foo( )" | elixir -e 'IO.puts IO.stream(:stdio, :line) |>
Enum.join("") |> Code.format_string!()'
*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*
On Sun, Oct 15, 2017 at 3:43 PM, Jan Fornoff <[email protected]> wrote:
> Agree with Ron. It'd be a great and editor-agnostic addition to have an
> option to utilize STDIN for quicker formatting experience on save!
>
> Would be willing to help if a hand is needed!
> Best,
> Jan
>
> On Friday, 13 October 2017 17:58:25 UTC+2, [email protected] wrote:
> > Thanks for the responses.
> >
> >
> > Yes, I was trying to avoid running an Elixir node to keep things as
> simple as possible. Vim, Emacs, Sublime, VS Code, etc will each need to
> integrate with the new code formatter. Supporting stdin/stdout via a
> command line option would make integration simple and consistent across all
> editors. Otherwise, each editor will need to run an Elixir node or use a
> tmp file (to support formatting files that haven't been saved to the file
> system yet).
> >
> >
> > Thanks again for the feedback.
> >
> >
> > Ron
> >
> >
> >
> > On Thursday, October 12, 2017 at 5:18:45 PM UTC-5, OvermindDL1 wrote:
> > The atom packages I've seen for elixir run an elixir node to do syntax
> coloring, highlighting, intellisense, and more. They should either use one
> of those connections directly (best speed) or they could just run it on the
> command-line.
> >
> >
> > On Thursday, October 12, 2017 at 4:09:38 PM UTC-6, Allen Madsen wrote:
> > I suspect the Atom package can't have elixir in it, which is probably
> why he was hoping there'd be the stdin/stdout support in the mix format
> command itself.
> >
> >
> >
> > Allen Madsen
> > http://www.allenmadsen.com
> >
> >
> > On Thu, Oct 12, 2017 at 5:42 PM, OvermindDL1 <[email protected]> wrote:
> >
> > You can just call the formatting function directly. :-)
> >
> >
> > iex(1)> Code.format_string!("blah 42")
>
> > ["blah", "(", "", "42", "", ")"]
> >
> > iex(2)> Code.format_string!("blah 42") |> :erlang.iolist_to_binary()
>
> > "blah(42)"
> >
> >
> >
> >
> > On Thursday, October 12, 2017 at 2:35:45 PM UTC-6, [email protected]
> wrote:
> > I apologize if this topic has already been covered.
> >
> >
> >
> > Have there been any discussions about adding support for reading/writing
> via stdin/stdout to the new code formatter coming v1.6?
> >
> >
> > I've release an Atom package that formats Elixir code automatically on
> save using the new formatter. If the formatter supported stdin/stout it
> would eliminate the need to write to a tmp file, which would greatly reduce
> latency.
> >
> >
> > I'm happy to help implement this, but wanted to see if there had been
> any discussion already.
> >
> >
> > Thanks in advance!
> >
> >
> > Ron Green
> >
> >
> >
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> Groups "elixir-lang-core" group.
> >
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> >
> > To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/c7102ea4-d4fe-4a83-b0f2-
> 07feea48f577%40googlegroups.com.
> >
> >
> >
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/b2d7edb0-81be-4a75-903e-
> b35dfb7a3247%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BDtsYktESF04hO3ZFLHT1gi3WTKd%2BgrEd8muLqD4rxAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.