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

False positive on indent with try/catch and typealias #1788

Closed
eygraber opened this issue Jan 24, 2023 · 0 comments · Fixed by #1851
Closed

False positive on indent with try/catch and typealias #1788

eygraber opened this issue Jan 24, 2023 · 0 comments · Fixed by #1851

Comments

@eygraber
Copy link
Contributor

Expected Behavior

The following code is valid:

fun test() = try {
  1
}
catch(_: Throwable) {
  2
}

and

typealias Foo =
  HashMap<Bar, Baz?>

Observed Behavior

ktlint formats the code like this:

fun test() = try {
  1
}
  catch(_: Throwable) {
    2
  }

and

typealias Foo =
HashMap<Bar, Baz?>

Steps to Reproduce

Run ktlint --format

.editorconfig:

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
indent_size = 2
indent_style = space
insert_final_newline = true
ktlint_experimental = enabled
ktlint_experimental_comment-wrapping = disabled
ktlint_experimental_function-naming = disabled
ktlint_experimental_function-signature = disabled
ktlint_experimental_property-naming = disabled
ktlint_standard_annotation = disabled
ktlint_standard_filename = disabled
ktlint_standard_keyword-spacing = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_no-semi = disabled
ktlint_standard_package-name = disabled
ktlint_standard_spacing-between-declarations-with-annotations = disabled
ktlint_standard_string-template = disabled
max_line_length = 120

The formatting is correct when ktlint 0.47.1 is used

Your Environment

  • Version of ktlint used: 0.48.2
  • Operating System and version: Ubuntu 22.04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants