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

Recognize 'ij_kotlin_packages_to_use_import_on_demand' from EditorConfig #1272

Merged
merged 3 commits into from Mar 8, 2022

Conversation

asmadsen
Copy link
Contributor

@asmadsen asmadsen commented Nov 3, 2021

Description

Add configuration option for allowing certain wildcard imports.
This is to make developing with libraries like ktor or kotlin-react more pleasant. These libraries rely heavily on extension functions, which in turn adds a lot of imports.

Checklist

  • tests are added
  • CHANGELOG.md is updated

@paul-dingemans
Copy link
Collaborator

paul-dingemans commented Jan 22, 2022

We should not introduce a new configuration option for this. It is better to use property "ij_kotlin_packages_to_use_import_on_demand" (mapping to field "Packages to use Import with '*' on the import tab of the Kotlin Code Style preferences) as this has the same purpose in the IntelliJ preferences. In this way we keep IntelliJ preferences and Ktlint configuration in sync.

Note that there is sublte different in the value of this variable which relates to checkbox "With subpackages". This should be taken into account:

ij_kotlin_packages_to_use_import_on_demand=com.example.** # with subpackages
ij_kotlin_packages_to_use_import_on_demand=com.example.* # without subpackages

@paul-dingemans
Copy link
Collaborator

Hi @asmadsen ,

Do you plan to work on this?

We should not introduce a new configuration option for this. It is better to use property "ij_kotlin_packages_to_use_import_on_demand" (mapping to field "Packages to use Import with '*' on the import tab of the Kotlin Code Style preferences) as this has the same purpose in the IntelliJ preferences. In this way we keep IntelliJ preferences and Ktlint configuration in sync.

Note that there is sublte different in the value of this variable which relates to checkbox "With subpackages". This should be taken into account:

ij_kotlin_packages_to_use_import_on_demand=com.example.** # with subpackages
ij_kotlin_packages_to_use_import_on_demand=com.example.* # without subpackages

@asmadsen
Copy link
Contributor Author

asmadsen commented Mar 3, 2022

@paul-dingemans Hi, sorry for the late reply.
I'll take a look at it, hopefully I'll be able to update the PR during the weekend.

@asmadsen asmadsen changed the title Add 'allowed_wildcard_imports' configuration Recognize 'ij_kotlin_packages_to_use_import_on_demand' from EditorConfig Mar 6, 2022
…to editorconfig to make 'no-wildcard-imports' more granularly configurable
- Refer to PR in changelog
- Add exception to rule description in README.md
- merge nested if
- Move companion object to end of class
- rename variables
- inline/extract constants
- improve and expand unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants