Closed ex-ratt closed 1 month ago
@ex-ratt does this lead to incorrect code? if not, it works exactly as configured.
Yes, the code still compiles and seems to work as well.
You don't find it odd that the indentation is not consistent across different operators and situations?
if you don't mind, i will close this. what you're describing is default yet configurable behavior. the configuration parameters are well documented.
Hi, I don't mind. Had a look through the config to figure out what I was missing. In case someone else stumbles across this:
There is a configuration indentOperator.excludeRegex
with a default value of ^(&&|\\|\\|)$
, which excludes &&
and ||
from indentation. I would not have thought that the default handles these operators different from others, which is why I didn't even think about checking.
My bad. Thanks for pointing this out :)
Configuration
Command-line parameters
When I run scalafmt via CLI like this:
scalafmt Test.scala
Steps
Given code like this:
Problem
Scalafmt formats code like this (changes indentation in lines starting with operators):
This happens with operator
||
as well (but not with other operators).Expectation
I would not expect the indentation to change. Instead, I would have assumed no change at all.
Workaround
The indentation stays the same if:
&
or|
), or