Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Wrong indentation when use tab style #1245

Closed
Keldmar opened this issue Oct 6, 2021 · 7 comments
Closed

Wrong indentation when use tab style #1245

Keldmar opened this issue Oct 6, 2021 · 7 comments

Comments

@Keldmar
Copy link

Keldmar commented Oct 6, 2021

When using tabs instead of spaces, I constantly get an error in the class constructor, if the parameters are specified vertically, in the example you can see that only the second class is validated, when using spaces there is no such problem

.editorconfig file

root = true
[*.{kt,kts}]

indent_style = tab

Sample class

package somepackage

internal class SomeClass(
				private val someField1: String,
	private val someField2: String,
	private val someField3: String
) {

	val s = 1

	fun someTest(
		someField1: String,
		someField2: String,
		someField3: String
	) {
		/* ignore */
	}
}

internal class SomeClass2(private val someField1: String, private val someField2: String, private val someField3: String) {

	val s = 1

	fun someTest(someField1: String, someField2: String, someField3: String) {
		/* ignore */
	}
}

image

SomeClassTest.kt:4:1: Unexpected indentation (4) (should be 1)
SomeClassTest.kt:4:5: Unexpected indentation (expected 4, actual 4)
SomeClassTest.kt:5:2: Unexpected indentation (expected 4, actual 1)
SomeClassTest.kt:6:2: Unexpected indentation (expected 4, actual 1)
SomeClassTest.kt:12:3: Unexpected indentation (expected 5, actual 2)
SomeClassTest.kt:13:3: Unexpected indentation (expected 5, actual 2)
SomeClassTest.kt:14:3: Unexpected indentation (expected 5, actual 2)
@paul-dingemans
Copy link
Collaborator

There are more known problems related to tab indentations. I have solved most of them a long time ago but it's PR (and several other unpublished PR's which are blocked by it) is till in the process of reviewing.

@VovaStelmashchuk
Copy link

@paul-dingemans Can you provide branch from your fork with this fixs, i will use your fork for myself?

@paul-dingemans
Copy link
Collaborator

@paul-dingemans Can you provide branch from your fork with this fixs, i will use your fork for myself?

See https://github.com/paul-dingemans/ktlint/tree/multiline-string-indent-all-fixes. Note: this is build on the current development version of ktlint. The branch is provided as is. No support will be provided on it.

@paul-dingemans
Copy link
Collaborator

@Keldmar @VovaStelmashchuk The PR mentioned before was merged into version 0.43.0 recently. Can you please check whether the tab indentation problems are solved for you when running with that version? Please note, that we have several open problems with this release, but they are not related to tab indentation.

@paul-dingemans
Copy link
Collaborator

Closing issue as the problem is resolved in a previous release. Please reopen if the issue is not yet solved for you.

@bfichter
Copy link

I'm still experiencing this issue with 0.43.2

@paul-dingemans
Copy link
Collaborator

I'm still experiencing this issue with 0.43.2

@bfichter please add details for your specific problem and setup in a new issue.

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

No branches or pull requests

4 participants