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

Feature request: configurable spaces around infix types #660

Closed
Atry opened this Issue Dec 31, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@Atry

Atry commented Dec 31, 2016

I created a compiler plugin to provide ## syntax https://github.com/ThoughtWorksInc/implicit-dependent-type
I hope people feel that Foo[Bar]##Baz is similar to native syntax Foo[Bar]#Baz. However, there's currently no configuration to do that, and scalafmt always add spaces around ##, i.e. Foo[Bar] ## Baz.

  • Version: 0.5
  • Integration: IntelliJ
  • Configuration: default

Unexpected formatting output

Obtained, scalafmt formats code like this:

val hlistForFoo: Generic[Foo] ## Repr = 1 :: "xxx" :: HNil

Expected, I would like the formatted output to look like this:

val hlistForFoo: Generic[Foo]##Repr = 1 :: "xxx" :: HNil

@olafurpg olafurpg changed the title from No configuration to remove spaces around a particular type infix to Feature request: configurable spaces around infix types Dec 31, 2016

@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Jan 5, 2017

Member

As discussed on gitter, I am happy to add an option to configure the space around infix type parameters. I suggest to name the flag spaces.neverAroundInfixTypes: Seq[String] = [], which you could configure to be ["##"].

If someone is motivated to take on this issue, the tutorial should contain all the necessary instructions to fix it, see https://github.com/olafurpg/scalafmt/blob/master/Tutorial.md

Member

olafurpg commented Jan 5, 2017

As discussed on gitter, I am happy to add an option to configure the space around infix type parameters. I suggest to name the flag spaces.neverAroundInfixTypes: Seq[String] = [], which you could configure to be ["##"].

If someone is motivated to take on this issue, the tutorial should contain all the necessary instructions to fix it, see https://github.com/olafurpg/scalafmt/blob/master/Tutorial.md

olafurpg added a commit that referenced this issue Jan 8, 2017

#660: Feature request: configurable spaces around infix types (#669)
* Feature request: configurable spaces around infix types #660

* remove line between if/else

* Default value changed to Nil. Test and fix for infix term if defined.
@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Jan 22, 2017

Member

This was fixed by @ysusuk! In 0.5.2 you will be able to configure

spaces.neverAroundInfixTypes = ["##"]
Member

olafurpg commented Jan 22, 2017

This was fixed by @ysusuk! In 0.5.2 you will be able to configure

spaces.neverAroundInfixTypes = ["##"]

@olafurpg olafurpg closed this Jan 22, 2017

@olafurpg olafurpg modified the milestone: 0.5.2 Jan 22, 2017

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