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

[8.0.x] Code formatting #1589

Closed
NeQuissimus opened this issue Dec 20, 2017 · 1 comment
Closed

[8.0.x] Code formatting #1589

NeQuissimus opened this issue Dec 20, 2017 · 1 comment
Labels

Comments

@NeQuissimus
Copy link
Member

NeQuissimus commented Dec 20, 2017

We have different styles floating around the code right now.
Let's use Scalafmt to make things consistent.

@fommil says a new sbt plugin is going to be available in the near future, so we can probably wait for that.

This pretty much sums up step 2:

then we can fight over settings, I have some pretty aggressive settings

This is @fommil's set of preferences:

align = most
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
docstrings = JavaDoc
lineEndings = preserve
includeCurlyBraceInSelectChains = false
danglingParentheses = true
spaces {
  inImportCurlyBraces = true
  inByNameTypes = false
}
optIn.annotationNewlines = true

rewrite.rules = [SortImports, RedundantBraces]

This is what I currently use:

maxColumn = 120
align.openParenCallSite = false
align.openParenDefnSite = false
align.ifWhileOpenParen = false
continuationIndent.defnSite = 2
continuationIndent.extendSite = 2
optIn.selfAnnotationNewline = false
optIn.configStyleArguments = false
spaces.afterTripleEquals = true
spaces.inImportCurlyBraces = true
danglingParentheses = true
includeCurlyBraceInSelectChains = false
importSelectors = singleLine

Related to #1464

@fommil
Copy link
Contributor

fommil commented Dec 20, 2017

also, in the meantime, we could use the hack I use, which is about x10 faster than the scalafmt plugins that are out there

// WORKAROUND: until https://github.com/scalameta/scalafmt/issues/1081
commands += Command.args("fmt", "scalafmt CLI") {
  case (state, args) =>
    val Right(scalafmt) =
      org.scalafmt.bootstrap.ScalafmtBootstrap.fromVersion("1.3.0-16-49815ab4")
    scalafmt.main(
      List(
        "--config",
        "project/scalafmt.conf",
        "--git",
        "true",
        "--exclude",
        "testing",
        "--non-interactive"
      ) ++: args
    )
    state
}

plus copy https://github.com/ensime/ensime-server/blob/3.0/project/Bootstrap.scala into project/

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