Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Unclear & inconsistent formatting. #10

Closed
cschneid opened this issue Jun 6, 2017 · 5 comments
Closed

Unclear & inconsistent formatting. #10

cschneid opened this issue Jun 6, 2017 · 5 comments

Comments

@cschneid
Copy link

cschneid commented Jun 6, 2017

Here is a comparison of input & output running exfmt on one of my more confusing files. (used exfmt's master as of a few minutes ago)

https://gist.github.com/cschneid/5eb14df36143b6080db5bbb9fee697b5

  • moduledoc comments get slammed into one line, with \n literals
  • Sometimes 2 lines between functions, sometimes none.
  • Function arrows seem somewhat randomly placed. (one with a missing space before, and one with a whole line to itself)
@lpil
Copy link
Owner

lpil commented Jun 6, 2017

Hi!

The work on the style has not yet been started. In this early alpha phase the aim is to maintain semantic correctness. Once that has been achieved work on the output style can begin.

If you like to make an issue each for the string formatting, the function spacing, and for the arrow functions that would be appreciated, thank you! :)

@cschneid
Copy link
Author

cschneid commented Jun 6, 2017

The first item is a semantic change imo - it's editing the literal text of a comment I entered, putting in \n characters instead.

But I agree on the other 2, thanks. I'll check back when the format decisions start happening.

@lpil
Copy link
Owner

lpil commented Jun 6, 2017

I'm using semantically the same to mean that they are parsed to the same abstract syntax tree by the Elixir compiler, perhaps I need a better word. :)

@cschneid
Copy link
Author

cschneid commented Jun 6, 2017

Right. It actually took me a sec to realize that it was turning a triple-quoted string into a single-quoted string, which then made the \n and such make sense.

@lpil
Copy link
Owner

lpil commented Jun 6, 2017

It's because the Elixir parser does this:

iex(1)> quote do: """
...(1)> hi!
...(1)> """
"hi!\n"

I plan to fix this, but may take a little while to get there :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants