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
vito-c
@vito-c
@kitbellew thanks! I responded to the issue
Jakub Kozłowski
@kubukoz

Hi, is it possible to configure the alignment here so that Foo.bar's ending parenthesis is on the same indentation as Foo?

object Demo {
  def execute(args: Args): Result =
    for {
      _ <- Foo.bar(
            arg
          )
    } yield ()
}

Here's the config:

version = "2.4.2"
align = some
align.arrowEnumeratorGenerator = true
it's one character too shallow, which drives me nuts
in fact, arg should also get a space before
claford-v-lawrence
@claford-v-lawrence
Hi, does anyone know how to make “ integer number too large “ disappear? I scanned through the documentation, but didn’t really find anything come up
Gavin Bisesi
@Daenyth
Is there a ticket for RedundentBraces to remove braces inside pattern matches?
Like in case x => { foo }
Gavin Bisesi
@Daenyth

I just found a bug;
I was upgrading from 2.3.1 to 2.4.2
I added RedundentParens rewrite

I see diff in the shape of:

def old = foo.map { a => b: SomeType => blah() }
def new = foo.map(a => b: SomeType => blah())

And new there is a compile error because you need parens on the type for b

Is this a known issue or should I file one with more detail
Albert Meltzer
@kitbellew
@Daenyth no, there are no known issues in 2.4.2; could you please create one?
Gavin Bisesi
@Daenyth
thanks
Albert Meltzer
@kitbellew
@Daenyth for now, you can disable the rule via rewrite.redundantBraces.parensForOneLineApply=false
Paweł Stawicki
@amorfis
Can scalafmt remove newlines? Sometimes I find myself removing newlines and formatting a file, to see if something changes. If after removing newlines the line becomes too long, obviously some newlines are added. However, if it's not too long, it remains unchanged by scalafmt. But I needed to remove newlines by hand. Is there some config option allowing scalafmt to do it automatically? Remove newlines when it doesn't make line too long?
Albert Meltzer
@kitbellew
@amorfis it does, depending on config, but not in all cases, infix being one. also see #1627
Gavin Bisesi
@Daenyth
@kitbellew thanks, I'll give that a spin. I rolled back the commit that changed it, will see what the diff looks like with that config in place. I wish those deep toggles were better documented :(
Gavin Bisesi
@Daenyth
hmm
The changelog on the website seems to lack the 2.4 releases
Should I ticket that?
Adam Fraser
@adamgfraser
Is there a way to turn one setting off for a block of code but not to disable all formatting?
Kamil Szymon Jadeszko
@Jadeszek

Hi! Do you know maybe, is it possible to have imports formatted by scalafmt like that?

import foo.bar.baz.{
  x,
  y,
  z,
}

Opening { in same line as common import path, every element inside {} in new line, not necessary sorted (but it would be even better, if existing rewrite rule for imports will allow to have it).

Albert Meltzer
@kitbellew

The changelog on the website seems to lack the 2.4 releases

@Daenyth you should report it. i don't really know how it's done, but one of the old-timers should.

Opening { in same line as common import path, every element inside {} in new line, not necessary sorted (but it would be even better, if existing rewrite rule for imports will allow to have it).

@Jadeszek sorting rewrite rules exist, but i don't think forced newline is available.

Is there a way to turn one setting off for a block of code but not to disable all formatting?

@adamgfraser i think you can use // scalafmt: <one parameter setting> to modify configuration, until you explicitly set it to something else later on

Zhange
@zhan-ge
Hey guys, is there a way to insert a blank line after first comment of the file and before class declaration, eg:
/**
 * @author zhange on 2020-03-07.
 */
// I want to insert a blank line here.
sealed trait Position
Ayush Tiwari
@AyushTiwary
How can I configure scalafmt so that each { must start with new line?
Gavin Bisesi
@Daenyth
{ \n or \n { ?
The former is easy, I forget the name but check the docs
jaksky
@jaksky

Guys, I am hitting following error in intellij idea

.scalafmt.conf. 
                    Invalid fields: trailingCommas

Any hints? According to doc this seems to be a valid config. I upgraded to scalafmt-core to 2.4.2 and and sbt plugin to 2.3.2

Setup intellij idea accoring to instructions
scalafmt plugin 1.5.1
jaksky
@jaksky
Removing plugin fix the issue
Gavin Bisesi
@Daenyth
The scalafmt plugin for IJ is dead - it only supports the old versions of scalafmt
support is now built into the scala plugin
Ayush Tiwari
@AyushTiwary
@all is there any way to open the start curly braches { always from the new line?
Gavin Bisesi
@Daenyth
@AyushTiwary you probably don't need to try to send push notifications to almost 400 people for a question on the tool. Check the docs, there's options about how to control newlines around braces. Failing that, open a ticket
Pierre Ricadat
@ghostdogpr

Hi! Is there a way to preserve the alignment in a for comprehension when there's a multiline statement:

  for {
    a   <- Option(1)
    bbb <- Option(2)
    cccccc <- Option {
               3
             }
  } yield ()

I would like:

  for {
    a      <- Option(1)
    bbb    <- Option(2)
    cccccc <- Option {
               3
             }
  } yield ()
Wojtek Pituła
@Krever
Would love to know the answer, was bothered by the same thing :)
felher
@felher
Yeah, I'm curious about that do.
Reid Mewborne
@8bitreid

Hi, I’m new to configuration of scalafmt… my code is changing order for things I don’t want to change order on. Example (before) :

package example

object OrderingIsHard {

  case class Person(name: String)

  def getName: String = name

  val name = "reid"

}

exmple (after):

package example

object OrderingIsHard {

  val name = "reid"

  def getName: String = name

  case class Person(name: String)

}
I would like it to not change the order here … I have nothing in my config … just a version… I’ve been trying to remove things until it stopped doing this. but I can’t find it in the docs where it changes ordering … could this be intelliJ ?
Tomasz Godzik
@tgodzik
I've never seen scalafmt to change the order of things and running it on your example it doesn't for me. Looks like Intellij, maybe you can disable the default formater? Or it's another option, should be somewhere in the options under formatting or organize maybe?
Reid Mewborne
@8bitreid
thanks. I’ll check it out!
Reid Mewborne
@8bitreid
… can’t see anything standing out at this time …
Pierre Ricadat
@ghostdogpr
@Krever @felher created scalameta/scalafmt#1811
felher
@felher
@ghostdogpr Thanks! :)
Olli Raula
@Bysmyyr
Hey, could someone tell what is "style = defaultWithAlign" many use it but there is no info about it anywhere what it does. In my current configuration it is same than default
Mikkel Storgaard Knudsen
@MikkelStorgaard
Is it possible to disable SortModifiers in a single file?
I've looked at some other rules, and it looks like they can be disabled by adding // scalafmt: {rewrite.someRule=false} to the file, but it doesn't seem like the same is the case for SortModifiers