hvesalai / emacs-scala-mode

The definitive scala-mode for emacs
http://ensime.org
GNU General Public License v3.0
361 stars 68 forks source link

Indenting For Comprehensions #134

Open nloyola opened 7 years ago

nloyola commented 7 years ago

Would it be possible to indent For Comprehensions like this?

for {
  i <- List
       .range(1, n)
       .filter(x => (x%2) == 0)
  j <- List
       .range(1, i)
  if isPrime(i+j)
} yield {i, j}

I.e., I want .range and .filter aligned under List.

I tried all the settings for scala-indent:default-run-on-strategy but they do not modify the indentation and I get:

for {
  i <- List
  .range(1, n)
  .filter(x => (x%2) == 0)
  j <- List
  .range(1, i)
  if isPrime(i+j)
} yield {i, j}
fommil commented 7 years ago

Sounds reasonable, you'll more than likely have to submit a PR for that. It would be good to support whatever scalafmt and scalariform do also.