Closed toresbe closed 2 months ago
Thanks for bringing this to my attention.
The solution documented for IntelliJ could very well be outdated. In newly created Kotlin projects, I do not see the .idea/codeStyles
directory being created anymore. So I will update this page that those files should be deleted. I will add below to this page (and make a reference from the wildcard import page to this section):
insert_final_newline = true
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_packages_to_use_import_on_demand = unset
The documentation for the no-wildcard-import rule documents the changes to
.editorconfig
to make ktlint wildcard imports compatible with IntelliJ, but not the reverse case.The solution documented for IntelliJ isn't optimal for those of us who have
.idea
in.gitignore
but still wish to synchronize these settings across the team.Setting IntelliJ's Code Style settings and exported them to an
.editorconfig
file, yielding a file from which I added these to my.editorconfig
:Now when I use Optimize Imports in IntelliJ, the imports produced are in line with those expected by ktlint.
PS FWIW: I believe that together with the following setting, this .editorconfig defines the settings prescribed for
.idea/codeStyles/Project.xml
I also have set this one: