Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration: spaces inside parentheses ( arg ) #116

Closed
olafurpg opened this issue Mar 9, 2016 · 8 comments
Closed

Configuration: spaces inside parentheses ( arg ) #116

olafurpg opened this issue Mar 9, 2016 · 8 comments
Milestone

Comments

@olafurpg
Copy link
Member

olafurpg commented Mar 9, 2016

Original:

function(arg)

Scalafmt:

function(arg)

I would like the input to look like this:

function( arg )
@paulp
Copy link

paulp commented Apr 14, 2016

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}

@olafurpg
Copy link
Member Author

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

@dwijnand
Copy link
Contributor

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

@olafurpg
Copy link
Member Author

I've added 3 flags for 0.2.2

--spacesInParentheses
--spacesInSquareBrackets
--spacesInImportCurlyBraces

following clang-format naming convention.

@olafurpg
Copy link
Member Author

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.

@cvogt
Copy link

cvogt commented Apr 19, 2016

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

@cvogt
Copy link

cvogt commented Apr 19, 2016

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

@cvogt
Copy link

cvogt commented Mar 3, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@paulp @cvogt @dwijnand @olafurpg and others