commit | c71034fd3318096eb45797a8e93bbc3e2f42f21e | [log] [tgz] |
---|---|---|
author | facebook-github-bot <facebook-github-bot@users.noreply.github.com> | Thu Dec 19 15:25:56 2019 -0800 |
committer | facebook-github-bot <facebook-github-bot@users.noreply.github.com> | Thu Dec 19 15:25:56 2019 -0800 |
tree | 4a389fde4292f6dea8fe3877096a7c93bb0534d4 |
Initial commit fbshipit-source-id: 91b1d4a9703c0894565b21bf50d122e84ebe7ae6
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 { // }
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