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

for loop with multiline iteration has incorrect indention for closing brace #138

Open
tmccombs opened this issue Mar 15, 2017 · 1 comment
Labels

Comments

@tmccombs
Copy link

If the iteration part of a for loop is multiple lines, for example:

for {
  a <- b
  c <- d
} yield {
   // body
}

then when I type the second opening brace (after yield) it iwll indent the line so the first closing brace lines up with the line before, like:

for {
  a <- b
  c <- d
  } yield {

The same thing happens if the yield isn't there. Strangely , if I don't have the second opening brace the line with the closing brace indents correctly.

@ches ches added the Bug label Aug 11, 2021
@stumash
Copy link

stumash commented Aug 27, 2021

this also happens for function definitions, i.e. should do:

def foo(
  i: Int,
  j: Int,
): Int = {
  // body
}

but actually does:

def foo(
  i: Int,
  j: Int,
  ): Int = {
  // body
}

In fact, the exact same problem also exists for function calls, not only function definitions. I.e., it does this:

foo(
  1,
  2,
  ) // should not be indented

I went ahead and looked at indent/scala.vim to propose a fix, but vimscript man... helluva language

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

No branches or pull requests

3 participants