GithubHelp home page GithubHelp logo

Comments (8)

dwijnand avatar dwijnand commented on July 17, 2024 1

FWIW it's also a supported as an opt-in in IntelliJ's code style formatting.

from scalafmt.

paulp avatar paulp commented on July 17, 2024

Please also, and from my POV with greater urgency, spaces inside import selectors. Curly braces without whitespace induce claustrophobia.

Currently:

-import scala.{ Any, Long, Nothing, StringContext, Unit }
-import scala.annotation.unchecked.{ uncheckedVariance => uV }
-import java.{ lang => jl }
-import java.{ util => ju }
-import java.{ io => jio }
-import java.util.{ function => juf }
-import java.nio.{ file => jnf }
+import scala.{Any, Long, Nothing, StringContext, Unit}
+import scala.annotation.unchecked.{uncheckedVariance => uV}
+import java.{lang => jl}
+import java.{util => ju}
+import java.{io => jio}
+import java.util.{function => juf}
+import java.nio.{file => jnf}

from scalafmt.

olafurpg avatar olafurpg commented on July 17, 2024

Out of curiosity, is there any well documented Scala style guide that supports adding spaces like this? I know it's supported in scalariform and clang-format but I don't see it in the official Scala, Scala.js, Spark or Twitter style guides.

It's straightforward to fix this issue but each new configuration option adds a burden on scalafmt developers and users. I like clang-format's approach for this http://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options

cc/ @cvogt

from scalafmt.

olafurpg avatar olafurpg commented on July 17, 2024

I've added 3 flags for 0.2.2

--spacesInParentheses
--spacesInSquareBrackets
--spacesInImportCurlyBraces

following clang-format naming convention.

from scalafmt.

olafurpg avatar olafurpg commented on July 17, 2024

I changed my mind and decided to only add --spacesInImportCurlyBraces. I would hate it if scalafmt induces claustrophobia on @paulp 😜

The other two have not been properly followed up on since I was asked to support them. It's possible to revert f10ee86 in case we later decide to support those styles.

from scalafmt.

cvogt avatar cvogt commented on July 17, 2024

@olafurpg our internal coding style for a significantly sized code base at @xdotai would require both --spacesInParentheses and --spacesInImportCurlyBraces. And personally, I find method calls with spaces inside of parens much more readable.

from scalafmt.

cvogt avatar cvogt commented on July 17, 2024

So +1 for bringing --spacesInParentheses back. However you may want to distinguish calls from signatures.

from scalafmt.

cvogt avatar cvogt commented on July 17, 2024

@olafurpg Just trying scalafmt for a project. Not having spacesInParentheses is a blocker for me. Could we bring this back pretty please :)?

from scalafmt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.