Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

'Unexpected indentation' when indent_style=tab #1337

Closed
bfichter opened this issue Jan 19, 2022 · 3 comments
Closed

'Unexpected indentation' when indent_style=tab #1337

bfichter opened this issue Jan 19, 2022 · 3 comments

Comments

@bfichter
Copy link

I believe this is the same/similar to 1245, but I was asked to make a new issue so here it is.

Expected Behavior

Be able to use tabs and break out function calls, function declarations, and class declarations into new lines.

Observed Behavior

When using tabs, I get 'Unexpected indentation' errors wherever I break out function parameters or class fields out into new lines. ktlint always expect 3 more indents than it should (e.g. "Unexpected indentation (expected 4, actual 1)").

If I explicitly set indent_size=1, ktlint seems to expect the correct indentation level, but still reports an error (e.g. "Unexpected indentation (expected 1, actual 1)").

Steps to Reproduce

Minimal class example:

class SomeClass(
	private val field1: String,
	private val field2: String
)

.editorconfig:

[*.{kt,kts}]
indent_style=tab

ktlint output:

SomeClass.kt:2:2: Unexpected indentation (expected 4, actual 1)
SomeClass.kt:3:2: Unexpected indentation (expected 4, actual 1)

Your Environment

  • Version of ktlint used: 0.43.2
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): command line
  • Operating System and version: MacOS 11.6
@paul-dingemans
Copy link
Collaborator

Closed by #1284

@paul-dingemans paul-dingemans added this to the 0.44.0 milestone Jan 28, 2022
@Ankit-Laddha
Copy link

Hi @paul-dingemans what is the fix here? Couldn't identify it

@paul-dingemans
Copy link
Collaborator

I am not sure what your question is.

If you can reproduce this issue with latest ktlint version (0.45.2) then please create new issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants