Skip to content

Customize space for specific infix operators #4089

@charpov

Description

@charpov

I have defined ~ as infix method so I can write things like:

3 * x~2

Unfortunately, Scalafmt reformats this as 3 * x ~ 2.
To keep the code formatted as I like, it'd be nice to have a configuration spaces.neverAroundInfixOperators similar to the existing spaces.neverAroundInfixTypes.

Note: Scala combinators also use ~ as an infix operator and have examples such as:

def expr: Parser[Any] = term~rep("+"~term | "-"~term)

If this code is formatted using Scalafmt, I wonder what's the trick...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions