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
Albert Meltzer
@kitbellew
glad you're finally at the finish line
Wim Verreydt
@wimve

Hi, it seems that sbt-scalafmt is no longer available on maven central? https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt/2.4.2/
It is still in the search index though (probably explaining the geen maven badge on the installation documentation page) https://search.maven.org/artifact/org.scalameta/sbt-scalafmt/2.4.2/jar

What repository should I use to import this?

Wim Verreydt
@wimve
Tnx for the info! In the end, it tuned out that I was running into an SBT issue https://github.com/sbt/sbt/issues/5263/. The fmt plugin import was configured correctly after all but the exception made it look like it was searching in the wrong place.
Felix Bruckmeier
@felixbr

Hi,

Is Scala3 using already supported?

I've tried to replace implicit with using and the compiler is happy but scalafmt (3.0.0-RC5) isn't:

private def fetchEntry(
  vertical: Vertical
)(using db: DBConnections) = ...

// OR

private def fetchEntry(
  vertical: Vertical
)(using DBConnections) = ...

In both cases I get:

error:   : expected but identifier found
)(using db: DBConnections) =
        ^:

If you need more information I can also open an issue but I thought it may be a known problem (or me being dumb) 🙂

Fabio Labella
@SystemFw
@felixbr try runner.dialect = scala3
Felix Bruckmeier
@felixbr
@SystemFw Thanks, that does the trick 👍
Eric K Richardson
@ekrich
WIll using {{{ and }}} keep scalafmt from messing with html? If so, will the html still render ok?
1 reply
Tag '@throws' must be followed by a symbol name
5 replies
Seems like the current wrapping cause scaladoc errors?
Eric K Richardson
@ekrich
I just put in an issue for the second problem as the first is a known issue. scalameta/scalafmt#2609
Eric K Richardson
@ekrich
Does runner.dialect work on cross projects with Scala 2 and 3 code?
Albert Meltzer
@kitbellew
no. you need to use fileOverride
Eric K Richardson
@ekrich
Matthew de Detrich
@mdedetrich

So I have a question, I am trying to make

preset = default
align.preset = most

Work with sbt's := operator (in the same way it works with the standard = where it vertically aligns it)

I am trying to use align.tokens.add to achieve this, i.e.
align.tokens.add = [
  {code = ":=", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))"}
]
However nothing seems to be working
i.e. I am getting
ThisBuild / scalaVersion := "2.13.6"
ThisBuild / version := "0.1.0-SNAPSHOT"
Instead of
ThisBuild / scalaVersion := "2.13.6"
ThisBuild / version      := "0.1.0-SNAPSHOT"
This is my current .scalafmt.conf
version = 2.7.5
preset = default
align.preset = most
maxColumn = 120
project.git = false
align.tokens.add = [
  {code = ":=", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))"}
]
align.openParenDefnSite = true
align.openParenCallSite = true
align.arrowEnumeratorGenerator = true
align.tokenCategory {
  Equals = Assign
  LeftArrow = Assign
}
danglingParentheses.preset = true
rewrite.rules = [RedundantBraces, RedundantParens]
Also does align.tokenCategory even do anything anymore?
4 replies
Matthew de Detrich
@mdedetrich
(I think its safe to remove this?)
Matthew de Detrich
@mdedetrich
Note that I am using scalafmt command line tool to format the project (i.e. running scalafmt in the root project), specifically https://aur.archlinux.org/packages/scalafmt-native-bin
trauts
@trauts:matrix.org
[m]

I'm trying to figure out which scalafmt rule is causing a linebreak to be inserted. I have the following two lines formatted the way I want them:
a.b.c.d()
.send()

but scalafmt is inserting a newline:
a.b.c
.d()
.send()

I've looked at the various configs for 'chain' and 'newline' and 'dot' and haven't figured out which rule is causing this. Any ideas?

the closest rule I've seen is optIn.breakChainOnFirstMethodDot but that doesn't seem to be it
vonchav
@voonchav_gitlab
Hi, 3.0.0-RC6 is out but I'm getting this error: [error] failed to download v=3.0.0-RC6
2 replies
Matthew de Detrich
@mdedetrich
Does anyone know if there is a native graalvm scalafmt-cli build for debian/ubuntu (i.e. similar to https://aur.archlinux.org/packages/scalafmt-native-bin)
3 replies
fanf42
@fanf42:matrix.org
[m]

Hello, sorry if it's a well know case, I'm new to scalafmt and didn't find info in doc. I would like to align the : in class definition, ie in place of aligning the type definition like the exemple in https://scalameta.org/scalafmt/docs/configuration.html#aligntokens, I would like to have

case class Foo(
  firstParam : Int,
  secondParam: String,
  thirdParam : Boolean
)

Is it possible ?

Albert Meltzer
@kitbellew
not currently
fanf42
@fanf42:matrix.org
[m]
ok thanks, too bad. It seems that I really have special tastes in vertical alignement and line break :)
(I also like my commas in front, valigned)
fanf42
@fanf42:matrix.org
[m]
perhaps a way to v-align comma at end of line? I don't find a way with the AST explorer, though
Albert Meltzer
@kitbellew
there was a parameter, something about poor man, that puts commas at the beginning of the line
the formatter can only align tokens which normally have a preceding space
Eric K Richardson
@ekrich
@fanf42 Just as a datapoint, we went away from extra alignment in the lastest scalafmt update in Scala Native. We found that alignment increases the diff with only minor changes. For example: changing the above to secondParams: List[String], would adjust the lines above and below.
fanf42
@fanf42:matrix.org
[m]
@ekrich: shouldn't it be a decision of the user? If we like well aligned tokens and are happy with w=1 for ex? (rationnal: the diff is transitional, the resulting source code readability remains)
but thanks for the data point
(so one datapoint: I don't care for large diff, and I'm a bit psychopathic about valign. I also do understand that I'm in a tiny group, and so it's ok that scalafmt dev allocate their resources otherwise than to please me ;) Someday, I will have time to contribute to one more project...)
Eric K Richardson
@ekrich
It is up to you but for the most part the defaults are good and alignment over time creates extra churn that is all. Originally, scalafmt was pretty opinionated but has become very flexible - "that battle was lost" to quote the creator of scalafmt. My personal opinion is that most of formatting is just personal preference and consistency from repo to repo is nice but honestly just using scalafmt makes one less thing to think about which is its greatest benefit regardless of the settings.
Lots of people like the vertical alignment :smile:
3 replies
fanf42
@fanf42:matrix.org
[m]
interesting. Thanks for that feedback
Eric K Richardson
@ekrich
Mostly, software is about having fun, so whatever makes you happy - do that first. Exploring and learning are fun.
Yuriy Yarosh
@yuriy-yarosh

So, I'm using scalafmt with Scala3 right now and my imports are being rewritten from

import cats.effect.*
import cats.syntax.all.*
import org.http4s.blaze.server.*
import org.http4s.implicits.*
import org.http4s.server.*

import scala.annotation.internal.*

to

import cats.effect
import cats.syntax.all
import org.http4s.blaze.server
import org.http4s.implicits
import org.http4s.server

import scala.annotation.internal

How to make scalafmt leave .* suffix ?

I'm ok with rewritting ._ to .* though.

using default config

version = "3.0.0-RC6"
runner.dialect = scala3
preset = default
6 replies
Fabrizio Colonna
@ColOfAbRiX
Hi! Is there a way I can use scalafmt to have such formatting on the implicit parameters?
class MyService(
  param1: String,
  param2: String)(
  implicit
  param3: String,
  param4: String
) {
  ...
}
Albert Meltzer
@kitbellew
@ColOfAbRiX yes
Fabrizio Colonna
@ColOfAbRiX
ok :) I asked because I played a lot with newlines.implicit* and danglingParentheses but I can't make it work. Best I could do was to have the )( on the left of the implicit. Could you tell me what configuration should I use?
2 replies
Bill Frasure
@swoogles
Hey all, is there a timeline for getting scalafmt-dynamic_3 published for Scala 3?