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.
If-else expressions in Scala are not aligned well in Intellij IDEA
-
20-07-2023 - |
Вопрос
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?
Решение
Не связан с StackOverflow