Question

Consider the following function definition...

def func(a: Int, b: Int): Int =
  if (a == 0) 1
else .... //not aligned

as you can see, the else part is not aligned with the if. This happens after typing the 1 and pressing the enter key. I have to manually align them myself (move the cursor back to the beginning of the last line and hit the tab key).

Is there a way to make it auto-align?

Was it helpful?

Solution

Try to write this code inside the block {} or use ctrl+alt+l for auto-aligning. I also prefer to write code in a single line when not using blocks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top