Giter VIP home page Giter VIP logo

Comments (2)

darioseidl avatar darioseidl commented on September 1, 2024

Looks like this is intentional, going by the comments in the code

* Lists that cannot fit on one line will have trailing commas inserted. Lists that span
* multiple lines will have them removed. Manually inserted trailing commas cannot be used as a
* hint to force breaking lists to multiple lines.

(Btw. that comment seems to have a mistake. I guess it should say, "Lists that fit on one line will have them removed.")

* Record elements which should have trailing commas inserted.
*
* This function determines which element type which may need trailing commas, as well as logic
* for when they shold be inserted.
*
* Example:
* ```
* fun foo(
* x: VeryLongName,
* y: MoreThanLineLimit // Record this list
* ) { }
*
* fun bar(x: ShortName, y: FitsOnLine) { } // Ignore this list
* ```
*/

Personally, I would also prefer if anything with two arguments would be formatted on multiple lines with trailing commas.

Edit: after using 0.52 a bit, I feel strongly that more than one argument should go on separate lines. The whole point of trailing commas is to make merge conflicts easier, isn't it? That should not depend on whether it fits on one line.

from ktfmt.

LandonPatmore avatar LandonPatmore commented on September 1, 2024

I rolled back to even 0.50 and am seeing this constructor snafu showing up.

We had this:

class RealSettingsWorkflow @Inject constructor(
  private val oAuthTokenService: OAuthTokenService,
  @UserId private val userId: String,
  @VersionName private val versionName: String,
) : StatefulWorkflow<Unit, SettingsState, RootOutput, BodyAndOverlaysScreen<Screen, Overlay>>() {

is now:

class RealSettingsWorkflow
@Inject
constructor(
  private val oAuthTokenService: OAuthTokenService,
  @UserId private val userId: String,
  @VersionName private val versionName: String,
) :
  StatefulWorkflow<Unit, SettingsState, RootOutput, BodyAndOverlaysScreen<Screen, Overlay>>() {

I am using spotless, but I don't think it is causing this since it delegates to ktfmt. As an ex-Square, I do agree that the Square method is much easier to read. This current format it both ugly and makes me have to move my eyes down to see important information.

from ktfmt.

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.