GithubHelp home page GithubHelp logo

Kotlin 1.4 support about ktfmt HOT 16 CLOSED

facebook avatar facebook commented on July 27, 2024
Kotlin 1.4 support

from ktfmt.

Comments (16)

CrushedPixel avatar CrushedPixel commented on July 27, 2024 4

Any update on this?

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024 3

Yeah, we need to at least upgrade the parser to 1.4.
I have a draft diff with the changes required to ugprade to 1.4, I'll get to it soon-ish.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024 3

@JavierSegoviaCordoba, I finally got around to it. There's a link to Maven Central from https://github.com/facebookincubator/ktfmt/releases/tag/v0.19 .

from ktfmt.

ramonsaboya avatar ramonsaboya commented on July 27, 2024 2

@cgrushko snippet of ktfmt failure for fun interface:

public fun interface PacketHandlerFunction<T : Packet<*>> : (Player, T?) -> T?

I'm getting the error:

33:11: error: Expecting function name or receiver type
com.facebook.ktfmt.ParseError: 33:11: error: Expecting function name or receiver type

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024 2

Almost got it to work: #68

I can't figure out how to tell Maven not to compile Kotlin13InputAstVisitor.kt, so one must first delete this file before compiling.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024 2

Yes, I expect we'll figure it out soon.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024 1

Let me release a new version.

from ktfmt.

JavierSegoviaCordoba avatar JavierSegoviaCordoba commented on July 27, 2024 1

Thank you very much :)

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024
  1. Trailing commas are already supported
  2. I skimmed https://blog.jetbrains.com/kotlin/2019/12/what-to-expect-in-kotlin-1-4-and-beyond/, and seems that most new things should already work.
  3. fun interface might actually work out of the box, depending on how it's represented in the AST. If not, it should be a trivial amount of work.

Question - do you happen to have a list of snippets where ktfmt fails? Having them in the format of unit-tests in FormatterKtTest.kt would be wonderful :)

from ktfmt.

jackmahoney avatar jackmahoney commented on July 27, 2024

Much appreciate your work. Thanks

from ktfmt.

jackmahoney avatar jackmahoney commented on July 27, 2024

@cgrushko do you possibly have the update for this? If you want to open a work in progress pull request maybe I can help?

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

Apologies for the delay - we're still on 1.3 internally, and I was hoping we'll get to 1.4 any day.
Because we build internally inside a monorepo, we need to make special arrangement to build both for 1.3 and for 1.4.
As I said, I was hoping I can get away with waiting a bit.

The problem is that Kotlin's interface of the visitor has changed in a backwards incompatible way.

Let me see if I can whip up something using reflection.

from ktfmt.

JavierSegoviaCordoba avatar JavierSegoviaCordoba commented on July 27, 2024

@cgrushko do you think the new version will be available this week? I am going to start a new project and I would like to test it there to get some conclusions before presenting it to my partners so we can use it instead ktlint or detekt

from ktfmt.

JavierSegoviaCordoba avatar JavierSegoviaCordoba commented on July 27, 2024

I am checking maven central and I don't find it. Is it in a snapshot repository so I can start testing it?

from ktfmt.

JavierSegoviaCordoba avatar JavierSegoviaCordoba commented on July 27, 2024

@cgrushko The IntelliJ plugin has to be updated to get the last version? I checked the code and I see it is using val ktfmtVersion = "0.18"

I don't know if there is a way that lets you avoid the usage of it directly in the project and adding a spinner menu with all the current versions available in MavenCentral. If you think it is possible I can file a new issue to ask this there as a feature request.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

Ugh, the AS plugin is a problem we didn't figure out yet. I think what you suggest makes total sense, and is much better than releasing a plugin every time AS or ktfmt changes, but doing this is probably more complicated (unless IntelliJ plugins have access to such capability from the platform?)

The underlying is reason is of course that we have our own in-house plugin, so we don't dogfood this.

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.