Code Monkey home page Code Monkey logo

Comments (8)

nicklockwood avatar nicklockwood commented on June 18, 2024 1

@mnazirov that's a super-old version. Can you check that it's still happening on 0.51.15 before I investigate further? Thanks.

from swiftformat.

nicklockwood avatar nicklockwood commented on June 18, 2024 1

@mnazirov thanks for double checking. The issue is that --nowrapoperators only applies to operators, and < isn't considered an operator by SwiftFormat when it's used as a bracket in a generics list.

It's not especially difficult for me to change that behavior, but I'm not sure if that would really solve your problem in this case, as it would just wrap at the , instead, which presumably isn't what you'd want.

What is the behavior you'd want in this case? Where should that line wrap?

from swiftformat.

mnazirov avatar mnazirov commented on June 18, 2024

@nicklockwood Updated to version 0.51.15, but the issue with line breaks in generic types still persists
 
Before formatting

func createConnectScreen() -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
   ...
}

 
After formatting

func createConnectScreen() -> DestinationStep<
        NewConnectFactory.ViewController,
        NewConnectFactory.Context
> {
   ...
}

from swiftformat.

mnazirov avatar mnazirov commented on June 18, 2024

@nicklockwood Thank you for the detailed explanation. I've tried to ensure only the method parameters wrap, while the return types of generics remain unchanged.

from swiftformat.

nicklockwood avatar nicklockwood commented on June 18, 2024

@mnazirov sure, I understand that. But in the example above there are no method parameters, so is your desired behavior that the line should just not wrap at all, even if it exceeds your specified max line width?

from swiftformat.

mnazirov avatar mnazirov commented on June 18, 2024

@nicklockwood Yep, I want the line breaks to only occur at method arguments. Can you please advise how I can achieve this result?)

Before formatting

func createConnectScreen(argument: Int, argument2: Int) -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
   ...
}

Expected formatting result

func createConnectScreen(
    argument: Int, 
    argument2: Int
) -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
   ...
}

from swiftformat.

nicklockwood avatar nicklockwood commented on June 18, 2024

@nicklockwood I think there's no way to do this currently other than to disable the wrap rule.

from swiftformat.

mnazirov avatar mnazirov commented on June 18, 2024

Thank you so much for the speedy reply)

from swiftformat.

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.