-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add EP to customize "Add Import" weights #2853
base: master
Are you sure you want to change the base?
Conversation
Friendly ping on this - any updates? |
Hi @andymagee ! We actually already have a simlar EP for callables - Could you please see if it is possible to extend it or introduce a new EP which would look similar to it? |
Fix for https://youtrack.jetbrains.com/issue/KTIJ-31471 KotlinAutoImportCallableWeigher allows customization of the order within the auto import list. This change updates it to more accurately handle imports for type names.
b8a6875
to
c3b4bf4
Compare
Thank you, I had missed that existing EP! The existing weigher uses I'm also removing the Let me know what you think, thanks. |
There's an existing test for TypeAlias import ordering, but it's only passing by accident. Adding a single parameter to the annotation that's being aliased causes the order to get swapped, which doesn't match the expected behavior. (I'm assuming the expected behavior is that the typealias should always be lower on the list; this is based on the existing test case.) The existing test case worked because the annotation had a default constructor with 0 arguments, and the referencing location that needs an import also has 0 arguments. But any time that argument count doesn't match, then the order is no longer determined by this weigher. This fix simply demotes any TypeAlias elements slightly.
Hi there, any comments on the updated changes? |
Sorry for the delay, I will take a look at it this week |
Hi @fedochet , have you had a chance to take a look at this PR? |
Fix for https://youtrack.jetbrains.com/issue/KTIJ-31471