https://kotlinlang.org logo
Title
p

Piotr Krzemiński

05/15/2023, 8:40 AM
here’s a conversation starter on handling star imports in IntelliJ. It looks like the default setting for Kotlin is using star imports already for a few (3/5) cases from a given package, but it doesn’t match the default setting of ktlint which is a very popular Kotlin linter. Does anyone know if there’s an effort to bring the two behaviors in sync? It’s a small but annoying thing that keeps appearing, especially in new setups. context: https://kotlinlang.slack.com/archives/C02UUATR7RC/p1684128633483979
c

Chris Lee

05/15/2023, 1:20 PM
Have the below in .editorconfig:
# as recommended by ktlint for consistency w/ IntelliJ: <https://pinterest.github.io/ktlint/rules/configuration-intellij-idea/>
ij_kotlin_packages_to_use_import_on_demand = java.util.*
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL

# ktlint configuration <https://pinterest.github.io/ktlint/rules/configuration-ktlint/>
ktlint_code_style = official
p

Piotr Krzemiński

05/15/2023, 1:21 PM
thanks, this is roughly what we converged to in the mentioned thread. I’m getting a 404 for https://pinterest.github.io/ktlint/rules/configuration-intellij-idea/ - are you aware of a new URL?
c

Chris Lee

05/15/2023, 2:15 PM
ugh, hate it when you go to all the trouble to retain links/context - and then they are gone, with no obvious replacement (bad form - that link is #3 in google for “ktlint intellij sync”). Sorry, not aware of an alternative.
e

ephemient

05/15/2023, 3:26 PM