1

I am trying to setup scalafmt.config, such that it formats my code. All the features I am using -- such as align.preset = more, align.openParenDefnSite = false etc. -- seem to work perfectly. However, I have an issue with indentation. I want to set it to 4, not 2 as it is at the moment. So, I tried using the following:

continuationIndent.callSite = 4
continuationIndent.defnSite = 4
continuationIndent.ctorSite = 4

And no success. I expected my whole code to indent by 4, but it is still at indent 2.

I am using Visual Studio Code with Metals as my plugin. Also, I have scalafmt installed locally on my laptop version 2.5.0.

Mark
  • 143,421
  • 24
  • 428
  • 436
  • 1
    I do not think it is possible to have 4 spaces everywhere. There's even an issue on GitHub: https://github.com/scalameta/scalafmt/issues/1493. Since 2 spaces is a Scala standard, they seem to have decided not to support it – user May 04 '20 at 17:33
  • @user thanks for your reply! Guess this answers the question. – Daniel Gannota May 06 '20 at 07:07

1 Answers1

1

Configuring indent.main = 4 works fine for me

# .scalafmt.conf
version = "3.5.3"
runner.dialect = scala212
indent.main = 4
yuxuan-z
  • 11
  • 2