Ktlint: Support tabs through .editorconfig

Created on 14 Dec 2017  路  11Comments  路  Source: pinterest/ktlint

Our source uses tabs instead of spaces. Can ktlint have support for "indent_style = tab" in the .editorconfig?

And yes, I know you can unset the indent_style, but that will also allow indenting with spaces, which we don't want.

enhancement proposal

Most helpful comment

Some people aren't writing Android code. Some people writing Android code use tabs. I think having the option is good.

All 11 comments

I don't think we would want that. Also the Android Kotlin style guide forbid them.

Some people aren't writing Android code. Some people writing Android code use tabs. I think having the option is good.

The compiler decides what is legal syntax. It's productive for a team to all use the same coding standards so that everyone's code is more uniform and easier for everyone to read. I would love it if everyone used the official Kotlin style guide, but for various reasons all teams don't want to do that.

But if the syntax allows tabs, then why would a coding style checking tool not allow the same flexibility as the language itself? It seems this kind of restriction would have been better placed in the Kotlin compiler, and putting it in a coding style checking tool just means some people won't be able to use ktlint?

Or wait for someone to fork klint and add support for tabs ?

  • You already allow people to change the indent_size with values that are not considered good in the "Android Kotlin style guide".

And as @ebrowne72 said, Kotlin is not used only for Android related code.

possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)

indent_size=4
"makes ktlint ignore indentation completely" -> even tabs ?

https://twitter.com/shyiko/status/1028740776191090688 (tldr: send a PR and we'll merge it in)

@ebrowne72 What are you using now? Can you not use indent_style = "tab"?

@jaredsburrows I am not using ktlint at all because it doesn't support tabs. What I'm asking for is someone to add support for indent_style = "tab".

So still no one with enough motivation to make a PR for this? :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanniktech picture vanniktech  路  5Comments

jbarr21 picture jbarr21  路  5Comments

impatient picture impatient  路  5Comments

DanteAndroid picture DanteAndroid  路  3Comments

volo-droid picture volo-droid  路  4Comments