Giter Site home page Giter Site logo

Comments (5)

allevato avatar allevato commented on June 27, 2024

Are you using a configuration that disables respectsExistingLineBreaks, or does this occur even when respectsExistingLineBreaks is enabled?

from swift-format.

pronebird avatar pronebird commented on June 27, 2024

Using a configuration disabling existing line breaks

from swift-format.

allevato avatar allevato commented on June 27, 2024

Then yes, this is working as intended; the single statement in the case fits on the same line and no line break is forced there so it makes the opinionated choice.

If this is desired behavior, we'd have to add a new configuration option to require a line break after a case.

I don't think I'd want to specialize case statements though; if we do this we should probably treat all single-statement control flow statements equally, e.g.:

// Today, if it fits
if x { foo() }

// With some new option
if x {
  foo()
}

from swift-format.

Optiroc avatar Optiroc commented on June 27, 2024

I’ve been evaluating swift-format the last few days and the eagerness to fit as much as possible on single lines is a bit hard to swallow, while the option to respect existing breaks is too respectful. :)

This PR seemed promising until I saw the date. Is there any current work being done in this area?

from swift-format.

ahoppen avatar ahoppen commented on June 27, 2024

Tracked in Apple’s issue tracker as rdar://126948359

from swift-format.

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.