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
ex0ns
@ex0ns

Hello !
I'm struggling a bit to configure scalafmt to an existing style of a scala project (I don't want to change the style of the whole project, I'm trying to match it as close as possible). We have a lot of case classes that look like that:

I would like the : and = to be aligned. I don't mind too much about the position of the first argument, I guess it could be right after ( depending on the maxColumn setting, same for the extends.
I tried

version = "2.7.4"

preset = default
align.preset = more
align.openParenDefnSite = false

maxColumn = 80

but the result is not correct for the parameters of my case classes

Tomasz Godzik
@tgodzik
What if you try:
align.preset = more
align.multiline = true
3 replies
also maybe use preset = most or https://scalameta.org/scalafmt/docs/configuration.html#aligntokens might help
ex0ns
@ex0ns
image.png
4 replies
Eric K Richardson
@ekrich
That looks pretty good, is that what you wanted?
ex0ns
@ex0ns
It seems that align.openParenDefnSite = true is not respected here and I can't find a way to put the parenthesis one the same line as the extends, but thank for the pointers @tgodzik
Eric K Richardson
@ekrich
I am confused on that one too as we have a codebase I'd like to upgrade scalafmt but it causes lots of changes. see here for related settings - https://github.com/scala-native/scala-native/blob/master/.scalafmt.conf
Eric K Richardson
@ekrich
I don't really like the openParen or align more or most much. You add or remove one thing and now you get a bunch of whitespace changes. I also am not sure why the default is all vertical except when you go to Scala 3 "significant whitespace". Formatting in a standard way is perfectly fine but this becomes a bikeshed and then nobody is happy and many people don't adopt scalafmt. They don't want a bunch of whitespace changes but this really has no basis for rebase or merge in git so I don't get it. Sorry about the rant. Look at the version above - hard to upgrade.
Stewart Stewart
@stewSquared
Is there an issue tracking optional braces?
I don't see any links in scalameta/scalafmt#2212
Also, might you know of related issues to watch in other repos? (like emacs scala-mode or vscode scala-syntax)
Actually, just found these:
vs code: scala/vscode-scala-syntax#179
emacs: hvesalai/emacs-scala-mode#160
Tomasz Godzik
@tgodzik
@stewSquared everything related to optional braces is being tracke here scalameta/scalafmt#2216
I already have some ideas around it, but need to fix some mroe things in the parser
2m
@2m:matrix.org
[m]

I am trying to use the latest scalafmt snapshot, but I am getting a following error:

Invalid version: 2.7.5+202-ace91064-SNAPSHOT

Should I format the version string a bit differently?

Tomasz Godzik
@tgodzik
I think that is due to the lack of resolver
not sure if it's possible to add the resolver to config
as a workaround you could use coursier to download the version from the sonatype snapshots repo
@2m:matrix.org
Eric K Richardson
@ekrich
@tgodzik I know you are super busy but have you had a chance to look at Scala Native scalafmt? Does it still use metaconfig? Maybe I could do a PR on that. Also, is paiges still used/getting updated anymore, looks a little old?
At one time Olafur was talking about a new formatter for scalafmt but said it was too much work - was that using paiges or pretty-print?
Tomasz Godzik
@tgodzik
@ekrich this is certainly on my mind, but I haven't looked into it yet :/ paiges seems not used anymore, I am not even sure what was it needed for
metaconfig on the other hand seems to be sued kind of all over the place
Eric K Richardson
@ekrich
I noticed Scala.js is commented out - do we need that for metaconfig or just native?
I can try and do that.
Tomasz Godzik
@tgodzik
no idea really, I only recently started working on it. I think JS was not that improtant
hmm... you meant that metaconfig was using paiges, maybe we can replace it with pprint
Eric K Richardson
@ekrich
Yeah, I see both in that build.
Let me see if I can get the native stuff in there and then we can go from there.
It was in there at one time.
Tomasz Godzik
@tgodzik
In the meantime I remove paiges from scalafmt scalameta/scalafmt#2398
Eric K Richardson
@ekrich
Ok, I commented out - we could update it - pprint now support 2.11 again thanks to jodersky probably which is really helpful.
The cli looks like it uses paiges - I could update if Olafur thinks it is worth it - did we give up on it and just use pprint?
Eric K Richardson
@ekrich
paiges is typelevel sorry - they dropped 2.11.
no native support
Tomasz Godzik
@tgodzik
We need to probably replace it with pprint for native - either repalce it altogether or just for native and create some compat classes
might be good to get some feedback from Olaf
Eric K Richardson
@ekrich
yeah, that is probably not that much - scalacheck-shapeless skips 2.11 for sjs 1 other stuff too.
Tomasz Godzik
@tgodzik
is shapeless used anywhere in scalafmt :O ?
Eric K Richardson
@ekrich
I think when lihaoyi dropped 2.11 it created a ripple downstream
Tomasz Godzik
@tgodzik
I don’t think paiges can easily be replaced with pprint.
It would be easier to inline the sources of paiges
Paiges has automated ci releases so it might also be worth trying to fix its cross-build.
citing Olaf
I asked him on discord
Eric K Richardson
@ekrich
Ok, it looks like typelevel has dropped 2.11 in release 0.4.0 would that be ok?
Sander Dijkhuis
@sander

How can I avoid the \n before _ in:

  class TsecLive[F[
      _]: Monad, HashAlgorithm, HmacAlgorithm, AuthCipher, AuthCipherSecretKey[
      _]](nonceSize: Int)(implicit
      val hasher: CryptoHasher[F, HashAlgorithm],

?

Tomasz Godzik
@tgodzik
@sander I think you can break if manually before F, which should put it all on the second line? We've been actually working on making long types work better, but that might come in 3.0.0
also not sure if it would solve your particular issue
Sander Dijkhuis
@sander
In this case that didn't work, possibly due to setting newlines { source = fold }
heksesang
@heksenlied:matrix.org
[m]
Is there a plan to release a version with Scala 3 support soon?
Tomasz Godzik
@tgodzik
@/all We've just released Scalafmt with support for Scala 3 ! Not yet final release, but please do test it out!
Odd Möller
@odd
:clap:
Przemek Sokół
@falconepl
:clap: