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
heksesang
@heksenlied:matrix.org
[m]
Doesn't seem to work.
heksesang
@heksenlied:matrix.org
[m]

before:

for {
  (id, user) <-
    create(
      givenName,
      surname,
      nin,
      memberships
    )
} yield user

after:

for {
  (id, user) <- create(
    givenName,
    surname,
    nin,
    memberships
  )
} yield user
1 reply
I want it to force the former.
But none of the options seem to do that.
Tomasz Godzik
@tgodzik
Might not be an option to do that then
Tomasz Godzik
@tgodzik
btw. @heksenlied:matrix.org I run the parser on https://gitlab.com/heksesang/scala3-derivation/-/tree/master and picked up a couple of bugs we had, which should work in the parser now
heksesang
@heksenlied:matrix.org
[m]
Is it possible to run a snapshot version of the latest code in master from Metals?
Tomasz Godzik
@tgodzik
not yet, I might have jumped the gun. I opened up a bunch of PRs with fixes, which are not yet merged
once we merge updated parser into scalafmt it should be possible to download the snapshot and try it out
heksesang
@heksenlied:matrix.org
[m]
Can I specify snapshot versions in the .scalafmt.conf file, or do I have to do something else to make it work with snapshots? Didn't really understand the instructions on the site in regards to snapshot versions last time I looked at it.
Tomasz Godzik
@tgodzik
This might actually work via Metals
I think you would need to add cpoursier repositories setting
export COURSIER_REPOSITORIES="ivy2Local|central|sonatype:snapshot" or in Metals setting
if used in metals settings it should be avialable when Metals tries to download the specific version
Tomasz Godzik
@tgodzik
seems it doesn't work :/
and use the created binary to run scalafmt
afterwards it should be cached lcoally so MEtals would be able to pick that up
Bill Frasure
@swoogles
Hey all, I've got a project where markdown files include fenced Scala snippets.
Is there any sort of standard approach for applying scalafmt to those snippets and altering them in-line?
Or is that not a proper use case for scalafmt, and it's really intended for .scala files only?
heksesang
@heksenlied:matrix.org
[m]
For Scala 3 files it seems that a line break is being forced before the extends part of each case in enum-definitions.
2 replies
Tomasz Godzik
@tgodzik
@heksenlied:matrix.org do you have an example? I would like to confirm it with the recent fixes
We'll release RC2 most likely this week
heksesang
@heksenlied:matrix.org
[m]

Seems your sample file does exactly that:

case Mercury
      extends Planet(
        3.303e+23,
        2.4397e6
      )

instead of:

case Mercury extends Planet(
  3.303e+23,
  2.4397e6
)
Tomasz Godzik
@tgodzik
in the example it breaks it like that due to column limit
since the full definition will not fit within 40 character column limit, we break it into multiple lines. That's the same behaviour as for classes
heksesang
@heksenlied:matrix.org
[m]
Okay, so my example there cannot be achieved as it is now?
Tomasz Godzik
@tgodzik
from what I know, not currently, but there might be some setting that I have no idea about
Tomasz Godzik
@tgodzik
btw. I haven't noticed before, but this seems to be fixing your issue: scalameta/scalafmt#2452
@heksenlied:matrix.org
heksesang
@heksenlied:matrix.org
[m]
Nice, now we just need to get that merged and release a 3.0.0-RC2 soon. :D
Tomasz Godzik
@tgodzik
@/all new release is out! We've managed to fix a number of issues connected to Scala 3, there are new rewrite rules to help out turning your code into actual Scala 3 code and a bunch of other improvements. Please check it out and report any issues that pop up. If nothing major is reported we will most likely make the final 3.0.0.
Tomasz Godzik
@tgodzik
By turning your code into actual Scala 3 I meant removing deprecated syntax
heksesang
@heksenlied:matrix.org
[m]
I assume everyone understands that, because if it was understood as anything else it would mean that scalafmt is pure magic. :P
Bill Frasure
@swoogles
Re-asking-
Hey all, I've got a project where markdown files include fenced Scala snippets.
Is there any sort of standard approach for applying scalafmt to those snippets and altering them in-line?
Or is that not a proper use case for scalafmt, and it's really intended for .scala files only?
1 reply
Hugo van Rijswijk
@hugo-vrijswijk
Is there a (rewrite) rule to format import x.{Y}to import x.Y for single-item imports?
3 replies
I can't find one in the configuration. Would it be a welcome addition?
Tomasz Godzik
@tgodzik
@swoogles you could use mdoc in that case with a custom string modifier that would invoke scalafmt
I think scalafmt itself does soemthing similar
thoguh, more complciated than that
@hugo-vrijswijk RedundantBraces maybe ?
heksesang
@heksenlied:matrix.org
[m]

Currently I am seeing:

inline def summonConfigReaders[T <: Tuple]: List[ConfigReader[_]] =
  inline erasedValue[T] match {
    case _: (h *: t) =>
      inline erasedValue[h] match {
        case _: Tuple => deriveForTuple[h & Tuple] :: summonConfigReaders[t]
        case _ => summonInline[ConfigReader[h]] :: summonConfigReaders[t]
      }

    case _: EmptyTuple => Nil
  }

being corrected to:

inline def summonConfigReaders[T <: Tuple]: List[ConfigReader[_]] =
  inline erasedValue[T] match {
    case _: (h *: t) =>
        inline
      erasedValue[h] match {
        case _: Tuple => deriveForTuple[h & Tuple] :: summonConfigReaders[t]
        case _ => summonInline[ConfigReader[h]] :: summonConfigReaders[t]
      }

    case _: EmptyTuple => Nil
  }
With 3.0.0-RC2.
Ishan Shah
@nullptr7
Intellij attempts to download the scalafmt jars from the public internet and the firewall in our org doesn't allow that. We do have scalafmt within our internal maven repository though. Is there any way we can point the Scala plugin to use a local scalafmt jar, or tell it what maven repo to download it from? Thanks
Tomasz Godzik
@tgodzik
@heksenlied:matrix.org that's a known issue
Alexandru Nedelcu
@alexandru

Hi all,

Any ideas how to fix this formatting issue? (at .via)

Flow[(A, Ctx)].map {
  case (a, ctx) =>
    rn.unsafe.logger.infoWithContext(logMsg)
    (a, ctx)
}
  .via(self)
  .map {
    case (b, ctx) =>
      rn.unsafe.logger.infoWithContext(logMsg)
      (b, ctx)
  }

I want those method calls to be on the same level. Something like this would be acceptable:

Flow[(A, Ctx)]
  .map {
    case (a, ctx) =>
      rn.unsafe.logger.infoWithContext(logMsg)
      (a, ctx)
  }
  .via(self)
  .map {
    case (b, ctx) =>
      rn.unsafe.logger.infoWithContext(logMsg)
      (b, ctx)
  }

It's fine that Scalafmt wants that .map on the same line, except when I have method chaining like this.

1 reply
Could it preserve my newlines somehow?