-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ktfmt-gradle
not in sync with intellij ktfmt
plugin when using googleStyle()
#277
Comments
@blipinsk +1. I originally posted this in #264 but was informed this was likely a ktfmt issue so I moved it over to facebook/ktfmt#444. |
Yup closing for the same reason |
@cortinico did you have the chance to go through my issue? It's clearly a problem with ktfmt-gradle. It says it provides googleStyle matching 0.47 from kfmt while it really doesn't. The internal FormatterOptions are not in sync with kfmt. The intellij plugin provides what it says it does - the GOOGLE_FORMAT from kfmt. ktfmt-gradle provides a limited version of it. |
I mean, maybe @gino-m's issue is not exactly the same, idk. Maybe that one presents a problem with kfmt. |
#272 |
@cortinico I'd appreciate if you read through my issue. |
I will be making a release in the coming minutes.
@blipinsk I'd also appreciate if you make a search before opening a new issue. You would have found #260 which was already closed and could have asked there for a release there instead of forcing me to read through a whole new issue. Thank you π |
Have a great day and thank you for taking the time to make a release π |
I'm sorry for mis-triaging this one. I receive thousands of issues every day, and this looked really similar to another issue that was opened some days ago. After all, the issue was already solved, and we do have a release out with the fix already π |
π Describe the bug
ktfmt-gradle
is not in sync with intellijktfmt
plugin when usinggoogleStyle()
π΅οΈ Details
(I think I got to the bottom of this, so I'm gonna just give you the full details)
ktfmt-gradle
(0.17.0) are usingktfmt
version0.47
, but...Google (internal)
, directly utilizesFormattingOptions
GOOGLE_FORMAT
fromktfmt
https://github.com/facebook/ktfmt/blob/6a639f00561219f3d520de271661013dc0209d4e/ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/UiFormatterStyle.java#L29
ktfmt-gradle
does not do the same thing directly. It internally createsFormattingOptions
which are intended to mimic theGOOGLE_FORMAT
fromktfmt
ktfmt-gradle/plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/KtfmtExtension.kt
Lines 65 to 71 in c7d7b9d
ktfmt-gradle/plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/tasks/worker/KtfmtFormatter.kt
Lines 56 to 72 in 6648a7a
ktfmt
version0.47
, the available0.17.0
version ofktfmt-gradle
is missingmanageTrailingCommas
handling.ktfmt-gradle/plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/KtfmtExtension.kt
Lines 19 to 55 in c7d7b9d
manageTrailingCommas
isfalse
by default inktfmt
https://github.com/facebook/ktfmt/blob/6a639f00561219f3d520de271661013dc0209d4e/core/src/main/java/com/facebook/ktfmt/format/FormattingOptions.kt#L58-L65
FormattingOptions
because Intellij Plugin usesGOOGLE_FORMAT
which hasmanageTralingCommas = true
https://github.com/facebook/ktfmt/blob/6a639f00561219f3d520de271661013dc0209d4e/core/src/main/java/com/facebook/ktfmt/format/Formatter.kt#L48-L50
ktfmt-gradle
uses customFormattingOptions
without overwriting the default value ofmanageTrailingCommas
which ends up beingfalse
.ktfmt-gradle/plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/KtfmtExtension.kt
Lines 67 to 71 in c7d7b9d
β Question
I can see you already added
manageTrailingCommas
handling here: #272Is there an ETA for releasing a new version of
ktfmt-gradle
with that included?π Related
facebook/ktfmt#444 (potentially)
facebook/ktfmt#455
The text was updated successfully, but these errors were encountered: