Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 26 2017 22:35
    olafurpg synchronize #947
  • May 26 2017 22:23
    olafurpg synchronize #947
  • May 26 2017 22:22
    olafurpg synchronize #947
  • May 26 2017 22:20
    olafurpg opened #947
  • May 26 2017 22:07
    olafurpg commented #943
  • May 26 2017 21:53

    olafurpg on v1.0.0-RC1

    (compare)

  • May 26 2017 21:46

    olafurpg on master

    Upgrade to non-broken metaconfi… Merge pull request #946 from ol… (compare)

  • May 26 2017 21:46
    olafurpg closed #946
  • May 26 2017 21:25
    olafurpg opened #946
  • May 26 2017 14:44

    olafurpg on master

    documentation fix: binPackParen… Merge pull request #945 from na… (compare)

  • May 26 2017 14:44
    olafurpg closed #945
  • May 26 2017 14:43
    olafurpg commented #943
  • May 26 2017 14:39
    olafurpg commented #943
  • May 26 2017 14:03
    pjrt commented #943
  • May 26 2017 13:36
    pjrt commented #943
  • May 26 2017 13:12
    nadavwr opened #945
  • May 25 2017 22:57
    ScalaWilliam commented #943
  • May 25 2017 21:34
    pauldraper commented #890
  • May 25 2017 21:34
    pauldraper commented #890
  • May 25 2017 17:23
    olafurpg commented #943
Adam Fraser
@adamgfraser
Hi. We're seeing some issues where scalafmt is rewriting previously valid code to code that no longer compiles under Dotty.
object Example {

  val okay =
    if (true)
      List(1, 2, 3) match {
        case x :: xs => ???
        case Nil => ???
      }
    else {
      2
    }

  val notOkay = 
    if (true)
      List(1, 2, 3) match {
        case x :: xs => ???
        case Nil => ???
    } else {
      2
    }
}
Is there something we can do in our scalafmt settings to avoid this? Happy to open an issue but wanted to ask first.
Miguel Iglesias
@caente
hello! how can I add a space before the argument list?
e.g.
def foo(a:Int ) ->  def foo( a:Int )

case class Foo(a: Int) -> case class Foo( a:Int )
Eric K Richardson
@ekrich
@caente That would be really strange. C/C++, Java, and Scala have all used argument lists with no space at the beginning and the end as far as I know. I think you would probably have to add a feature to support that but I am just guessing.
Miguel Iglesias
@caente
cool, thanks @ekrich sadly in our codebase we have that space, courtesy of scalariform, but scalariform doesn't integrate well with editors, so I'm considering scalafmt, but I'm trying to minimize the diff :/
Eric K Richardson
@ekrich
Well, I hope "really strange" doesn't come off too strong.
Miguel Iglesias
@caente
don't worry about it, we are all used to what we are used to :)
Eric K Richardson
@ekrich
Scalariform has that option or was the default?
Miguel Iglesias
@caente
we did that to ourselves
.setPreference(SpaceInsideParentheses, true)
Eric K Richardson
@ekrich
I can say one thing for sure. Using scalafmt is liberating - I use it how they do in Scala Native but that would probably create a huge diff. I have preferences but after using scalafmt, I don't really care that much at all. You really get used to it.
I think if you can get a minimal diff that should be fine, especially if you do the code base all at once. Might want to do bike shedding with the team to get the least offensive format to most all and then live with the diff. Human factors first :smile:
Miguel Iglesias
@caente
yup, agreed, editor integration is a big deal for us
Eric K Richardson
@ekrich
Also, if you use Metals with VSCode or another editor, or IntelliJ it will use the checked in .scalafmt.conf.
Lots of projects check formatting as part of CI passing as well. Good luck on your journey - hopefully we won't get a new formatter too soon.
Miguel Iglesias
@caente

Also, if you use Metals with VSCode or another editor, or IntelliJ it will use the checked in .scalafmt.conf.

yup, that is the whole reason for doing this :)

Lots of projects check formatting as part of CI passing as well.

we do that, but it is very annoying not being able to format from the editor itself

Eric K Richardson
@ekrich
Nice, I like the integration a lot. Yes, too easy to miss if you have to go to the command line and run. We should have a Scala Native version of scalafmt when the new version of Scala Native comes out. I runs hot in the JVM now so it is super fast now anyway.
Miguel Iglesias
@caente
well, it turned out that everyone really wanted the editor integration, the PR was approved immediately ^_^
thanks though!
Eric K Richardson
@ekrich
Nice great to hear.
Anil Kumar Myla
@anilkumarmyla
sbt-scalafmt new release https://github.com/scalameta/sbt-scalafmt/releases/tag/v2.0.6 failed to publish, anyone looking into it?
Mikhail Chugunkov
@poslegm
@anilkumarmyla Sonatype returns 50x codes on publishing, I am trying to figure out what the problem is
mohnishkodnani
@mohnishkodnani

Hi,
With sbt-scalafmt 2.0.5 I am getting the following error when I run scalafmtCheck on my project. This is the first time I am running it, I would appreciate if someone could explain what the below error means.
[error] invariant failed: [error] when verifying parentCheckOk.&&(org.scalameta.`package`.debug(this, parentPrefix, destination)) [error] found that parentCheckOk is false [error] where TermAssignImpl = projections = parameters: _* [error] where destination = stats [error] where parentCheckOk = false [error] where parentPrefix = Term.Block [error] where this = projections = parameters: _*: <Filename>

Code where I think its complaining
def project(parameters: Parameter*) = { projections = parameters: _* this }

mohnishkodnani
@mohnishkodnani
"this" is in the next line the markup got jumbedup.apologies.
Matthew Rothenberg
@mroth

With the new v2.1.0 release I'm suddenly seeing an error in attempting to compile via sbt cli/assembly:

[error] (cli / assembly) deduplicate: different file contents found in the following:
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/interface/0.0.12/interface-0.0.12.jar:reflect.properties
[error] /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.8/scala-reflect-2.12.8.jar:reflect.properties

CI output: https://github.com/mroth/scalafmt-native/runs/242381340#step:3:2325

Any ideas?

Mikhail Chugunkov
@poslegm
@mroth try to do it with coursier instead of sbt cli/assembly
CLASSPATH=$(coursier fetch org.scalameta:scalafmt-cli_2.12:2.1.0 | paste -s -d: -)
native-image -cp $CLASSPATH org.scalafmt.cli.Cli -H:+ReportUnsupportedElementsAtRuntime
Matthew Rothenberg
@mroth
@poslegm is that the new preferred invocation for compiling? or a means of debugging the current issue? (e.g. should I be manually running that to get debug output to help figure out the issue and reporting back, or is that actually how end-users are suppose to compile now and I should update CI scripts for it?)
Mikhail Chugunkov
@poslegm

@mroth It's the simplest way to get assembled and runnable cli. So it can be used in CI. But now I noticed that after scalameta/scalafmt#1511 GraalVM build is broken :c

Warning: Aborting stand-alone image build. Unsupported features in 5 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call: java.lang.invoke.MethodHandle.bindTo(Object)
...

I created issue about it scalameta/scalafmt#1514

Matthew Rothenberg
@mroth
@poslegm Thanks! I've updated my automated builds to do something similar based on that method (which also breaks in the same way as per your issue).
Moritz Bust
@Busti
Is there a rule to add a space before a context-bound colon :?
trait Foo[F[_]: Functor] // before
trait Foo[F[_] : Functor] // after
Currently it is automatically removed when formatting.
Ah there is spaces.beforeContextBoundColon = Always
Eric K Richardson
@ekrich

Hi, was attempting to switch to 2.1.0 from 1.5.1 and seeing allot of the following:

-    Compile / compile / javacOptions ++= Seq("-source",
-                                             "1.8",
-                                             "-target",
-                                             "1.8",
-                                             "-g",
-                                             "-Xlint:unchecked"),
+    Compile / compile / javacOptions ++= Seq(
+      "-source",
+      "1.8",
+      "-target",
+      "1.8",
+      "-g",
+      "-Xlint:unchecked"
+    ),

Is this the new standard - I am ok with it if this is the way to go?

Eric K Richardson
@ekrich
Seems like the docs change log is at 2.0.1 not 2.1.0.
BTW, this is my file
version = 2.1.0
style = defaultWithAlign
docstrings = JavaDoc
assumeStandardLibraryStripMargin = true
project.git = true
# manually exclude files to format.
project.excludeFilters = [
   sharedScala3
]
Eric K Richardson
@ekrich
@olafurpg This will affect Scala Native too when we upgrade and I know people don’t like these white space changes.
Ólafur Páll Geirsson
@olafurpg
@ekrich the defaults for alignment changed
you can add the following to get the old behavior
align.openParenCallSite = true
Eric K Richardson
@ekrich
@olafurpg Thanks, I know you changed defaults before but only after much deliberation that the default was a more standard format. I accepted the default for my project :smile:
YulawOne
@YulawOne
Hi everyone,
As per https://scalameta.org/scalafmt/docs/faq.html, it said Scalafmt takes liberty to add/remove newlines, making your entire codebase look consistent., but is it possible to opt-in this behavior and give an ability to decide on line breaks back to the developer?
Henri Cook
@henricook
Hi all
Does anyone know how i can add custom resolvers to scalafmt-dynamic?
I want it to resolve from my CI/CD dependency proxy instead of the public internet
or can i just turn off dynamic, or pre-load the binary on the image or something? It's a bit of a CI/CD nightmare
Henri Cook
@henricook
I created a small PR that I hope will mean COURSIER_REPOSITORIES gets honoured: https://github.com/scalameta/scalafmt/pull/1524/files