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

Correct indentation for for comprehensions #242

Closed
michalmuskala opened this issue Aug 26, 2015 · 3 comments
Closed

Correct indentation for for comprehensions #242

michalmuskala opened this issue Aug 26, 2015 · 3 comments

Comments

@michalmuskala
Copy link

Example:

for {k, v} <- keyword,
  v = process_value(v),
  into: %{}
  do: {v, k}

To be honest, I'm not sure that's the correct way to indent it, but I can't think of a different one that would make sense.

@whatyouhide
Copy link

FWIW, that's how I indent that kind of code as well. When I need do...end in the comprehension, I usually indent like this:

for {k, v} <- keyword,
    v = process_value(v),
    into: %{} do
  {v, k}
end

Just for the record, maybe not the best way to do it.

jesenko added a commit to jesenko/emacs-elixir that referenced this issue Sep 21, 2015
Added failing tests for `for` comprehensions, related to issue elixir-editors#242.
@jesenko
Copy link
Contributor

jesenko commented Sep 21, 2015

I added failing indentation tests for the cases given above + for the case when for comprehension is combined with assignment, e.g.

result =
  for {k, v} <- keyword,
      v = process_value(v)
      into: %{} do
    {v, k}
  end

jesenko added a commit to jesenko/emacs-elixir that referenced this issue Sep 21, 2015
Added failing tests for `for` comprehensions, related to issue elixir-editors#242.
@tonini tonini closed this as completed Apr 14, 2016
@tonini
Copy link
Contributor

tonini commented Apr 14, 2016

fixed by f721fb4

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

No branches or pull requests

5 participants