Hi all. I am looking for some clarification as to ...
# ktfmt
s
Hi all. I am looking for some clarification as to why ktfmt uses 2 spaces for indentation. What confuses me is that here: https://github.com/facebook/ktfmt/issues/14#issuecomment-674487325 it is said that the official Kotlin style guides uses 2 spaces, yet when looking here: https://kotlinlang.org/docs/coding-conventions.html#indentation it says ‘use four spaces’. Why does ktfmt use 2 spaces? 🤔 I hope someone can clear this up. Many thanks everyone!
j
if you set kotlinlang style it uses 4 spaces.
👍 1
n
The rationale is because this was created by Meta and the default style is the Meta style. Meta code is all formatted with 4 spaces. I hope this clarifies
*Meta code is all formatted with 2-space formatting
Okay, maybe not all since we have a TON of code, but most of it and enough to be considered a standard
j
@Nivaldo H Bondança personally, for an open source library for Kotlin, I think it should use Kotlinlang as default, and it should have an additional value with a specific name "Meta" or "Facebook". I understand this would be a pain in the ass for you internally
n
Honestly it would not affect us all that much TBH since most uses are through tooling, so they seldom require invoking ktfmt directly. You bring in some good food for thought here though. How about you open an issue in GitHub and I can help stir the discussion?
👍 1
n
You could put this in the channel as well, instead of just here in the thread (harder to find).
I've started the discussion internally about this. I'll post in the GitHub discussion regarding updates
👍 1