livebook icon indicating copy to clipboard operation
livebook copied to clipboard

Support formatter options

Open jonatanklosko opened this issue 1 year ago • 2 comments

Currently Livebook formats the code without respecting any plugins or formatter options. We could add Kino.formatter_options(...) with options matching .formatter.exs. The logic would be similar to the mix format task. In order to handle :import_deps, we would need to traverse the dependencies and read their .formatter.exs. There is no public API to do this for the Mix.install/1 project, but we could possibly make Mix.in_install_dir/1 public in Elixir.

For now this issue is mostly to track interest and use cases.

Also see prior discussion in #1212.

jonatanklosko avatar Jul 05 '24 17:07 jonatanklosko

I'd like and would use this. Especially useful for libraries with macros usually used without parens that want to write documentation with Livebook. (Edit: I see this is the primary consideration talked about in the linked past discussion was well 😄)

zachallaun avatar Jul 06 '24 16:07 zachallaun

I was the trigger for this issue over on slack a few days ago. I've been running into this with heex for building svg visualization in livebook, where the elixir code would format, but the heex markup wouldn't. Especially with tools like phoenix_playground components might become something more people build in livebook as well, even though this wasn't my usecase.

LostKobrakai avatar Jul 10 '24 06:07 LostKobrakai