commit | 6ff85123b399ec3af27f3252b4d854bce693a2c7 | [log] [tgz] |
---|---|---|
author | Carmi Grushko <carmi@fb.com> | Fri Dec 20 09:25:55 2019 -0800 |
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | Fri Dec 20 09:27:13 2019 -0800 |
tree | 322d1e519bb1b28b88c1bbeec251426ff62362df | |
parent | aeb1b88da0d5ea113cb5a21c4cabe8e32d2f439b [diff] |
Add google-java-format as a submodule Summary: Pull Request resolved: https://github.com/facebookincubator/ktfmt/pull/4 Reviewed By: strulovich Differential Revision: D19195021 Pulled By: cgrushko fbshipit-source-id: 74cb0b4bfa2b784cab3dae7a4942ce0a80512934
ktfmt
is a program that pretty-prints (formats) Kotlin code, based on google-java-format.
private fun declareOne( kind: DeclarationKind, modifiers: KtModifierList? = null, valOrVarKeyword: String? = null, typeParameters: KtTypeParameterList? = null, receiver: KtTypeReference? = null, name: String? = "", type: KtTypeReference? = null, op: String = "", equals: String = "=", typeConstraintList: KtTypeConstraintList? = null, initializer: PsiElement? = null, delegate: KtPropertyDelegate? = null, trailing: String? = null ): Int { // }
private fun declareOne( kind: DeclarationKind, modifiers: KtModifierList? = null, valOrVarKeyword: String? = null, typeParameters: KtTypeParameterList? = null, receiver: KtTypeReference? = null, name: String? = "", type: KtTypeReference? = null, op: String = "", equals: String = "=", typeConstraintList: KtTypeConstraintList? = null, initializer: PsiElement? = null, delegate: KtPropertyDelegate? = null, trailing: String? = null ): Int { // }
Note that ktfmt
still has some rough edges which we're constantly working on fixing.
vendor/google-java/format
submodule is populated. Either clone with submodules (git pull --recurse-submodules https://github.com/facebookincubator/ktfmt.git
) or populate the submodule after cloning (git submodule update --init
)mvn install
java -jar core/target/ktfmt-0.1-SNAPSHOT-jar-with-dependencies.jar
ktfmt
uses a 2-space indent; why not 4?Two reasons -
vendor/google-java/format
submodule is populated. Either clone with submodules (git pull --recurse-submodules https://github.com/facebookincubator/ktfmt.git
) or populate the submodule after cloning (git submodule update --init
)pom.xml
in IntelliJ. Choose “Open as a Project”FormatterKtTest.kt
.Apache License 2.0