facebook / ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
https://facebook.github.io/ktfmt/
Apache License 2.0
933 stars 78 forks source link

Convert IntelliJ plugin to Kotlin #502

Closed rock3r closed 3 months ago

rock3r commented 3 months ago

[!NOTE] This requires #501 to be merged first

This PR is the basis for future improvements of the plugin. In this PR, the plugin code is converted to Kotlin, the configurable is recreated with the Kotlin UI DSL, and the goal is to maintain the existing behaviours.

The only small change is that the style dropdown in the configurable is disabled when ktfmt is disabled.

rock3r commented 3 months ago

Not sure how to do that? I didn't know you could override what diff thinks happened

rock3r commented 3 months ago

@hick209 please advise so I can look into it tomorrow

rock3r commented 3 months ago

@hick209 I tried looking into this but I did not find a way to force Git to consider files as moved. I had kept the actual conversion of the files to Kotlin to a dedicated commit, too, but that did not help. Also tried re-doing the conversion in another branch by committing the moving first, and the conversion second, but the conversion still results in pairs of adding/deleting

hick209 commented 3 months ago

Yeah I looked it up as well and noticed this is not really doable in git :-/

I'm used to working with Mercurial, which allows this with the following command:

hg mv FROM TO --after

No worries, I can try to do that internally once we pull your changes. I have to wait until we merge the other 2 PRs for this though.

Thanks a ton for you contributions!

facebook-github-bot commented 3 months ago

@hick209 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

@hick209 merged this pull request in facebook/ktfmt@5d876ca010662a538807d6bf3cd68b03de62321b.